]> Dogcows Code - chaz/openbox/commitdiff
watch for bad actions and contexts
authorDana Jansens <danakj@orodu.net>
Tue, 4 Feb 2003 12:47:42 +0000 (12:47 +0000)
committerDana Jansens <danakj@orodu.net>
Tue, 4 Feb 2003 12:47:42 +0000 (12:47 +0000)
src/python.cc

index 84cfff291a7abb5ca8e310678ad47332cbb2bc77..a99416ae83899bc72ec3e4ec118321dbf9e18273 100644 (file)
@@ -101,6 +101,14 @@ PyObject *mbind(const std::string &button, ob::MouseContext::MC context,
     PyErr_SetString(PyExc_TypeError, "Invalid callback function.");
     return NULL;
   }
+  if(context < 0 || context >= MouseContext::NUM_MOUSE_CONTEXT) {
+    PyErr_SetString(PyExc_ValueError, "Invalid MouseContext");
+    return NULL;
+  }
+  if(action < 0 || action >= MouseAction::NUM_MOUSE_ACTION) {
+    PyErr_SetString(PyExc_ValueError, "Invalid MouseAction");
+    return NULL;
+  }
   
   if (!ob::openbox->bindings()->addButton(button, context,
                                           action, func)) {
This page took 0.024206 seconds and 4 git commands to generate.