From 7a07895920196c00d1ee14187e4ccdb2a6f0d0b9 Mon Sep 17 00:00:00 2001 From: "Wilson E. Alvarez" Date: Fri, 25 Aug 2017 11:14:33 -0400 Subject: Added/Fixed null pointer checks --- editor/animation_editor.cpp | 2 +- editor/editor_settings.cpp | 4 ++-- editor/plugins/canvas_item_editor_plugin.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'editor') diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp index 55542a59a2..5b24baabea 100644 --- a/editor/animation_editor.cpp +++ b/editor/animation_editor.cpp @@ -1646,7 +1646,7 @@ PropertyInfo AnimationKeyEditor::_find_hint_for_track(int p_idx, NodePath &r_bas List pinfo; if (res.is_valid()) res->get_property_list(&pinfo); - else + else if (node) node->get_property_list(&pinfo); for (List::Element *E = pinfo.front(); E; E = E->next()) { diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 5b73d83691..f8c37d586d 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -253,8 +253,8 @@ static void _create_script_templates(const String &p_path) { dir->change_dir(p_path); for (int i = 0; i < keys.size(); i++) { if (!dir->file_exists(keys[i])) { - file->reopen(p_path.plus_file((String)keys[i]), FileAccess::WRITE); - ERR_FAIL_COND(!file); + Error err = file->reopen(p_path.plus_file((String)keys[i]), FileAccess::WRITE); + ERR_FAIL_COND(err != OK); file->store_string(templates[keys[i]]); file->close(); } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 0dcabb1776..433145a2ee 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -3766,7 +3766,7 @@ bool CanvasItemEditorViewport::_cyclical_dependency_exists(const String &p_targe void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String &path, const Point2 &p_point) { child->set_name(path.get_file().get_basename()); - Ref texture = Object::cast_to(Ref(ResourceCache::get(path)).ptr()); + Ref texture = Ref(Object::cast_to(ResourceCache::get(path))); Size2 texture_size = texture->get_size(); editor_data->get_undo_redo().add_do_method(parent, "add_child", child); -- cgit v1.2.3