Răsfoiți Sursa

Merge pull request #10009 from marcelofg55/master

Fix possible division by zero crashes on the wav importer
Rémi Verschelde 8 ani în urmă
părinte
comite
daad16b7c7
1 a modificat fișierele cu 2 adăugiri și 2 ștergeri
  1. 2 2
      editor/import/resource_importer_wav.cpp

+ 2 - 2
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;