diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-08-01 09:45:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-01 09:45:50 +0200 |
commit | daad16b7c7a10f0f1ede92899573e9e354c9d2cd (patch) | |
tree | 79a5f0a2613753a1bdf70a2fbb727916b4307a8e | |
parent | 168cb8c94b230e487bdd2ff5cf82eec3d303240c (diff) | |
parent | af6f222b7997e1d4f7e0b1fc512d530151dd0783 (diff) |
Merge pull request #10009 from marcelofg55/master
Fix possible division by zero crashes on the wav importer
-rw-r--r-- | editor/import/resource_importer_wav.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp index 18c4bed5dd..8cb712cb78 100644 --- a/editor/import/resource_importer_wav.cpp +++ b/editor/import/resource_importer_wav.cpp @@ -291,7 +291,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s bool limit_rate = p_options["force/max_rate"]; int limit_rate_hz = p_options["force/max_rate_hz"]; - if (limit_rate && rate > limit_rate_hz) { + if (limit_rate && rate > limit_rate_hz && rate > 0 && frames > 0) { //resampleeee!!! int new_data_frames = frames * limit_rate_hz / rate; Vector<float> new_data; @@ -356,7 +356,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s bool trim = p_options["edit/trim"]; - if (trim && !loop) { + if (trim && !loop && format_channels > 0) { int first = 0; int last = (frames * format_channels) - 1; |