Skip to content

Commit

Permalink
bindings: xwii_throw_exception must be followed by a return
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
nadenislamarre authored and David Herrmann committed Oct 28, 2013
1 parent 58adbe8 commit f9025b5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/xwiimote.i
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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);
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down

0 comments on commit f9025b5

Please sign in to comment.