From f9025b541239ae5fb741662cedf1c4db94bac538 Mon Sep 17 00:00:00 2001 From: Nicolas Adenis-Lamarre Date: Sun, 6 Oct 2013 08:21:57 +0200 Subject: [PATCH] bindings: xwii_throw_exception must be followed by a return in iface constructor, the return missing causes to fill the bad errno because the call to watch was done with a NULL input. Signed-off-by: Nicolas Adenis-Lamarre --- src/xwiimote.i | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/xwiimote.i b/src/xwiimote.i index f0a4ec9..e0d160b 100644 --- a/src/xwiimote.i +++ b/src/xwiimote.i @@ -313,10 +313,12 @@ struct xwii_iface { if((ret=xwii_iface_new(&dev, syspath)) != 0) { xwii_throw_exception("xwii_iface_new() failed", ret, SWIG_IOError); + return NULL; } if((ret=xwii_iface_watch(dev, true)) != 0) { xwii_throw_exception("xwii_iface_watch() failed", ret, SWIG_IOError); + return NULL; } return dev; } @@ -395,6 +397,7 @@ struct xwii_iface { if((ret=xwii_iface_get_led($self, led, &state)) != 0) { xwii_throw_exception("xwii_iface_get_led failed", ret, SWIG_IOError); + return false; } return state; } @@ -420,6 +423,7 @@ struct xwii_iface { if((ret=xwii_iface_get_battery($self, &capacity)) != 0) { xwii_throw_exception("xwii_iface_get_battery failed", ret, SWIG_IOError); + return 0; } return ((int) capacity); } @@ -431,6 +435,7 @@ struct xwii_iface { if((ret=xwii_iface_get_devtype($self, &devtype)) != 0) { xwii_throw_exception("xwii_iface_get_devtype failed", ret, SWIG_IOError); + return NULL; } return devtype; } @@ -442,6 +447,7 @@ struct xwii_iface { if((ret=xwii_iface_get_extension($self, &extension)) != 0) { xwii_throw_exception("xwii_iface_get_extension failed", ret, SWIG_IOError); + return NULL; } return extension; }