From 1144c656fa9d956853fd8c03dc52937f60d3ee2e Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 14 Jul 2008 16:09:27 +0100 Subject: DBusPyServer: if there's no main loop, throw an exception The code starting at the "err" label assumes that an exception has been set already. --- _dbus_bindings/server.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/_dbus_bindings/server.c b/_dbus_bindings/server.c index 6af462f..3f32f43 100644 --- a/_dbus_bindings/server.c +++ b/_dbus_bindings/server.c @@ -232,8 +232,14 @@ DBusPyServer_NewConsumingDBusServer(PyTypeObject *cls, /* Change mainloop from a borrowed reference to an owned reference */ if (!mainloop || mainloop == Py_None) { mainloop = dbus_py_get_default_main_loop(); - if (!mainloop) + + if (!mainloop || mainloop == Py_None) { + PyErr_SetString(PyExc_RuntimeError, + "To run a D-Bus server, you need to either " + "pass mainloop=... to the constructor or cal " + "dbus.set_default_main_loop(...)"); goto err; + } } else { Py_INCREF(mainloop); -- cgit v1.2.1