diff options
author | Hubert Jarosz <marqin.pl+git@gmail.com> | 2016-03-01 00:08:33 +0100 |
---|---|---|
committer | Hubert Jarosz <marqin.pl@gmail.com> | 2016-03-09 00:18:23 +0100 |
commit | 7b07bcaf449ea6cf52c2ac501e48cddbe4bde035 (patch) | |
tree | 5d5c2abcc801262b72f02f5e9c7c70a20c729e73 /tools/editor/plugins/script_editor_plugin.cpp | |
parent | bf7f9244a95962c9833e68743726fe83a00b732c (diff) |
fix six possible "divide by zero"
Diffstat (limited to 'tools/editor/plugins/script_editor_plugin.cpp')
-rw-r--r-- | tools/editor/plugins/script_editor_plugin.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 2fb5dd619e..76c64beb61 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -1784,7 +1784,8 @@ void ScriptEditor::_update_script_colors() { if (h>hist_size) { continue; } - float v = Math::ease((edit_pass-pass)/float(hist_size),0.4); + int non_zero_hist_size = ( hist_size == 0 ) ? 1 : hist_size; + float v = Math::ease((edit_pass-pass)/float(non_zero_hist_size),0.4); script_list->set_item_custom_bg_color(i,hot_color.linear_interpolate(cold_color,v)); @@ -2704,4 +2705,3 @@ ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) { ScriptEditorPlugin::~ScriptEditorPlugin() { } - |