diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-02-04 12:47:42 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-02-04 12:47:42 +0000 |
| commit | df0447ce6d57c6ece97e69fc0874595e4ac0ae75 (patch) | |
| tree | 99ca3f90c3aeeb601bc1980a28159ea67fbfaf55 /src/python.cc | |
| parent | f28550dc28608a7ad4dadaedbef21e09171d18fa (diff) | |
watch for bad actions and contexts
Diffstat (limited to 'src/python.cc')
| -rw-r--r-- | src/python.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/python.cc b/src/python.cc index 84cfff29..a99416ae 100644 --- a/src/python.cc +++ b/src/python.cc @@ -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)) { |
