diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-08-27 02:10:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-27 02:10:56 +0200 |
commit | 612099e3771578fd3e78171f1ca1444f6c41cef3 (patch) | |
tree | c4173d550b3148c1223f67de0a8836dc744e831a /scene/gui | |
parent | ea55b400d908c01345a974cae82d8a8720e9904d (diff) | |
parent | 7a07895920196c00d1ee14187e4ccdb2a6f0d0b9 (diff) |
Merge pull request #10591 from Rubonnek/possible-null-ptr-dereference
Added/Fixed null pointer checks
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/text_edit.cpp | 4 | ||||
-rw-r--r-- | scene/gui/tree.cpp | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index e506953d77..a5de50af99 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -215,8 +215,8 @@ void TextEdit::Text::_update_line_cache(int p_line) const { const Map<int, TextEdit::Text::ColorRegionInfo> &TextEdit::Text::get_color_region_info(int p_line) { - Map<int, ColorRegionInfo> *cri = NULL; - ERR_FAIL_INDEX_V(p_line, text.size(), *cri); //enjoy your crash + static Map<int, ColorRegionInfo> cri; + ERR_FAIL_INDEX_V(p_line, text.size(), cri); if (text[p_line].width_cache == -1) { _update_line_cache(p_line); diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 38cd425a89..a40d1acb8f 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -2870,8 +2870,8 @@ TreeItem *Tree::create_item(TreeItem *p_parent) { TreeItem *ti = memnew(TreeItem(this)); - ti->cells.resize(columns.size()); ERR_FAIL_COND_V(!ti, NULL); + ti->cells.resize(columns.size()); if (p_parent) { |