summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2016-03-10 16:15:49 +0100
committerRémi Verschelde <remi@verschelde.fr>2016-03-10 16:15:49 +0100
commitaaad24e6fb1528fc6c773c0225ed9500c3fdd2bb (patch)
tree050800bfb1afbc562448967ee635834356c43af5 /scene/gui
parent042f8bf88c331197b05e9b250b48ef3f5632b4fe (diff)
parent7b07bcaf449ea6cf52c2ac501e48cddbe4bde035 (diff)
Merge pull request #3865 from Marqin/coverity
[Coverity] fixed 11 of 537 potential bugs found by Coverity
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/color_picker.cpp6
-rw-r--r--scene/gui/graph_edit.cpp2
2 files changed, 5 insertions, 3 deletions
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index f8f8b1f6d1..bd24b43761 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -361,7 +361,10 @@ void ColorPicker::_preset_input(const InputEvent &ev) {
emit_signal("color_changed", color);
} else if (ev.type == InputEvent::MOUSE_MOTION) {
const InputEventMouse &mev = ev.mouse_motion;
- int index = mev.x/(preset->get_size().x/presets.size());
+ int index = mev.x * presets.size();
+ if( preset->get_size().x != 0 ) {
+ index /= preset->get_size().x;
+ }
if (index<0 || index >= presets.size())
return;
preset->set_tooltip("Color: #"+presets[index].to_html(presets[index].a<1)+"\n"
@@ -684,4 +687,3 @@ ColorPickerButton::ColorPickerButton() {
picker->connect("color_changed",this,"_color_changed");
add_child(popup);
}
-
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index c9c9dbd1d2..9123194589 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -617,7 +617,7 @@ void GraphEdit::_input_event(const InputEvent& p_ev) {
if (b.button_index==BUTTON_LEFT && b.pressed) {
- GraphNode *gn;
+ GraphNode *gn = NULL;
for(int i=get_child_count()-1;i>=0;i--) {
gn=get_child(i)->cast_to<GraphNode>();