From: Mikko Rasa Date: Fri, 25 Nov 2016 11:21:18 +0000 (+0200) Subject: Fix incorrect comparisons X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=da43cbcdf8fd6cbfe3c24c48247854832f8b3930;p=libs%2Fgui.git Fix incorrect comparisons --- diff --git a/source/input/device.cpp b/source/input/device.cpp index 10f8d0c..2283136 100644 --- a/source/input/device.cpp +++ b/source/input/device.cpp @@ -12,7 +12,7 @@ Device::~Device() bool Device::get_button_state(unsigned btn) const { - if(btn>buttons.size()) + if(btn>=buttons.size()) return false; return buttons[btn]; @@ -20,7 +20,7 @@ bool Device::get_button_state(unsigned btn) const float Device::get_axis_value(unsigned axis) const { - if(axis>axes.size()) + if(axis>=axes.size()) return 0; return axes[axis];