diff options
author | qarmin <mikrutrafal54@gmail.com> | 2019-08-07 12:54:30 +0200 |
---|---|---|
committer | qarmin <mikrutrafal54@gmail.com> | 2019-08-07 12:54:30 +0200 |
commit | e0b5b218638df5b7b2998233182a7d8a1118e717 (patch) | |
tree | 0de2f04fbb41472d3bd9b43141f26193cb062be9 /editor | |
parent | 045ab51ae50139e645958149c6d6d354026ccdd4 (diff) |
Add some code changes/fixes proposed by Coverity and Clang Tidy
Diffstat (limited to 'editor')
-rw-r--r-- | editor/collada/collada.cpp | 2 | ||||
-rw-r--r-- | editor/editor_inspector.cpp | 3 | ||||
-rw-r--r-- | editor/editor_plugin.cpp | 3 | ||||
-rw-r--r-- | editor/editor_settings.cpp | 17 | ||||
-rw-r--r-- | editor/plugin_config_dialog.cpp | 3 |
5 files changed, 20 insertions, 8 deletions
diff --git a/editor/collada/collada.cpp b/editor/collada/collada.cpp index 57c00e1bef..edd59f3057 100644 --- a/editor/collada/collada.cpp +++ b/editor/collada/collada.cpp @@ -1696,7 +1696,7 @@ Collada::Node *Collada::_parse_visual_scene_node(XMLParser &parser) { } } - } else if (section == "node") { + } else { /* Found a child node!! what to do..*/ diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 70bbd0fd6c..8b3e108690 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -378,7 +378,7 @@ bool EditorPropertyRevert::get_instanced_node_original_property(Node *p_node, co node = node->get_owner(); } - if (!found) { + if (!found && node) { //if not found, try default class value Variant attempt = ClassDB::class_get_default_property_value(node->get_class_name(), p_prop); if (attempt.get_type() != Variant::NIL) { @@ -1302,6 +1302,7 @@ void EditorInspector::remove_inspector_plugin(const Ref<EditorInspectorPlugin> & } } + ERR_FAIL_COND(idx == -1); for (int i = idx; i < inspector_plugin_count - 1; i++) { inspector_plugins[i] = inspector_plugins[i + 1]; } diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index c2a845653e..399c89dce4 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -315,7 +315,8 @@ void EditorPlugin::remove_autoload_singleton(const String &p_name) { Ref<ConfigFile> EditorPlugin::get_config() { Ref<ConfigFile> cf = memnew(ConfigFile); - cf->load(_dir_cache.plus_file("plugin.cfg")); + Error err = cf->load(_dir_cache.plus_file("plugin.cfg")); + ERR_FAIL_COND_V(err != OK, cf); return cf; } diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 45000517cb..e3f2a888d6 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -773,10 +773,16 @@ void EditorSettings::create() { if (d->file_exists(exe_path + "/._sc_")) { self_contained = true; - extra_config->load(exe_path + "/._sc_"); + Error err = extra_config->load(exe_path + "/._sc_"); + if (err != OK) { + ERR_PRINTS("Can't load config from path: " + exe_path + "/._sc_"); + } } else if (d->file_exists(exe_path + "/_sc_")) { self_contained = true; - extra_config->load(exe_path + "/_sc_"); + Error err = extra_config->load(exe_path + "/_sc_"); + if (err != OK) { + ERR_PRINTS("Can't load config from path: " + exe_path + "/_sc_"); + } } memdelete(d); @@ -1208,9 +1214,12 @@ String EditorSettings::get_feature_profiles_dir() const { void EditorSettings::set_project_metadata(const String &p_section, const String &p_key, Variant p_data) { Ref<ConfigFile> cf = memnew(ConfigFile); String path = get_project_settings_dir().plus_file("project_metadata.cfg"); - cf->load(path); + Error err; + err = cf->load(path); + ERR_FAIL_COND(err != OK); cf->set_value(p_section, p_key, p_data); - cf->save(path); + err = cf->save(path); + ERR_FAIL_COND(err != OK); } Variant EditorSettings::get_project_metadata(const String &p_section, const String &p_key, Variant p_default) const { diff --git a/editor/plugin_config_dialog.cpp b/editor/plugin_config_dialog.cpp index 12bf544357..23056d25c0 100644 --- a/editor/plugin_config_dialog.cpp +++ b/editor/plugin_config_dialog.cpp @@ -130,7 +130,8 @@ void PluginConfigDialog::_notification(int p_what) { void PluginConfigDialog::config(const String &p_config_path) { if (p_config_path.length()) { Ref<ConfigFile> cf = memnew(ConfigFile); - cf->load(p_config_path); + Error err = cf->load(p_config_path); + ERR_FAIL_COND(err != OK); name_edit->set_text(cf->get_value("plugin", "name", "")); subfolder_edit->set_text(p_config_path.get_base_dir().get_basename().get_file()); |