1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

fix six possible "divide by zero"

This commit is contained in:
Hubert Jarosz
2016-03-01 00:08:33 +01:00
committed by Hubert Jarosz
parent bf7f9244a9
commit 7b07bcaf44
6 changed files with 23 additions and 15 deletions

View File

@@ -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()
{
}