Merge pull request #68626 from AleCamara/bug-66928-crash-preview-short-mp3

Fix editor crash on audio preview
This commit is contained in:
Rémi Verschelde 2022-11-14 18:29:57 +01:00
commit 19ae37cc99
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -42,6 +42,10 @@ float AudioStreamPreview::get_max(float p_time, float p_time_next) const {
}
int max = preview.size() / 2;
if (max == 0) {
return 0;
}
int time_from = p_time / length * max;
int time_to = p_time_next / length * max;
time_from = CLAMP(time_from, 0, max - 1);
@ -69,6 +73,10 @@ float AudioStreamPreview::get_min(float p_time, float p_time_next) const {
}
int max = preview.size() / 2;
if (max == 0) {
return 0;
}
int time_from = p_time / length * max;
int time_to = p_time_next / length * max;
time_from = CLAMP(time_from, 0, max - 1);