Browse Source

Don't show errors when getting nonexistent settings

Aaron Franke 3 years ago
parent
commit
40cb86ba96
1 changed files with 3 additions and 3 deletions
  1. 3 3
      core/config/project_settings.cpp

+ 3 - 3
core/config/project_settings.cpp

@@ -926,13 +926,13 @@ Error ProjectSettings::_save_custom_bnd(const String &p_file) { // add other par
 Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_custom, const Vector<String> &p_custom_features, bool p_merge_with_current) {
 	ERR_FAIL_COND_V_MSG(p_path == "", ERR_INVALID_PARAMETER, "Project settings save path cannot be empty.");
 
-	PackedStringArray project_features = get("application/config/features");
+	PackedStringArray project_features = has_setting("application/config/features") ? (PackedStringArray)get_setting("application/config/features") : PackedStringArray();
 	// If there is no feature list currently present, force one to generate.
 	if (project_features.is_empty()) {
 		project_features = ProjectSettings::get_required_features();
 	}
 	// Check the rendering API.
-	const String rendering_api = get("rendering/quality/driver/driver_name");
+	const String rendering_api = has_setting("rendering/quality/driver/driver_name") ? (String)get_setting("rendering/quality/driver/driver_name") : String();
 	if (rendering_api != "") {
 		// Add the rendering API as a project feature if it doesn't already exist.
 		if (!project_features.has(rendering_api)) {
@@ -952,7 +952,7 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust
 		}
 	}
 	project_features = _trim_to_supported_features(project_features);
-	set("application/config/features", project_features);
+	set_setting("application/config/features", project_features);
 
 	Set<_VCSort> vclist;