소스 검색

GDNative: Fix warning when gdnative/singletons is missing

Rémi Verschelde 7 년 전
부모
커밋
2b91a2059b
1개의 변경된 파일5개의 추가작업 그리고 2개의 파일을 삭제
  1. 5 2
      modules/gdnative/register_types.cpp

+ 5 - 2
modules/gdnative/register_types.cpp

@@ -99,12 +99,16 @@ static Set<String> get_gdnative_singletons(EditorFileSystemDirectory *p_dir) {
 }
 }
 
 
 static void actual_discoverer_handler() {
 static void actual_discoverer_handler() {
+
 	EditorFileSystemDirectory *dir = EditorFileSystem::get_singleton()->get_filesystem();
 	EditorFileSystemDirectory *dir = EditorFileSystem::get_singleton()->get_filesystem();
 
 
 	Set<String> file_paths = get_gdnative_singletons(dir);
 	Set<String> file_paths = get_gdnative_singletons(dir);
 
 
 	bool changed = false;
 	bool changed = false;
-	Array current_files = ProjectSettings::get_singleton()->get("gdnative/singletons");
+	Array current_files;
+	if (ProjectSettings::get_singleton()->has_setting("gdnative/singletons") {
+		current_files = ProjectSettings::get_singleton()->get("gdnative/singletons");
+	}
 	Array files;
 	Array files;
 	files.resize(file_paths.size());
 	files.resize(file_paths.size());
 	int i = 0;
 	int i = 0;
@@ -128,7 +132,6 @@ static void actual_discoverer_handler() {
 	if (changed) {
 	if (changed) {
 
 
 		ProjectSettings::get_singleton()->set("gdnative/singletons", files);
 		ProjectSettings::get_singleton()->set("gdnative/singletons", files);
-
 		ProjectSettings::get_singleton()->save();
 		ProjectSettings::get_singleton()->save();
 	}
 	}
 }
 }