Skip to content

Commit 8c53fd8

Browse files
authored
Fix null optional deref in 1.x code (#174)
1 parent ddeb427 commit 8c53fd8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/djinterop/engine/v1/engine_track_impl.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,11 @@ high_res_waveform_data to_high_res_waveform_data(
244244
std::optional<double> sample_rate,
245245
const std::vector<waveform_entry>& waveform)
246246
{
247+
if (!sample_count || !sample_rate)
248+
{
249+
return high_res_waveform_data{0};
250+
}
251+
247252
// Make the assumption that the client has respected the required number
248253
// of samples per entry when constructing the waveform.
249254
auto extents = util::calculate_high_resolution_waveform_extents(

0 commit comments

Comments
 (0)