Przeglądaj źródła

Polyimport won't crash now if assimp is unable to open scene

Ivan Safrin 13 lat temu
rodzic
commit
4b8d6e026c
1 zmienionych plików z 5 dodań i 2 usunięć
  1. 5 2
      Tools/Contents/polyimport/Source/polyimport.cpp

+ 5 - 2
Tools/Contents/polyimport/Source/polyimport.cpp

@@ -185,8 +185,11 @@ int main(int argc, char **argv) {
 
 	printf("Loading %s...\n", argv[1]);
 	scene = aiImportFile(argv[1],aiProcessPreset_TargetRealtime_Quality);
-
-	exportToFile(argv[2], strcmp(argv[3], "true") == 0);
+	if(scene) {
+		exportToFile(argv[2], strcmp(argv[3], "true") == 0);
+	} else {
+		printf("Error opening scene...\n");
+	}
 
 	aiReleaseImport(scene);
 	return 1;