summaryrefslogtreecommitdiff
path: root/navit/binding
diff options
context:
space:
mode:
authorsleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220>2015-01-19 22:06:24 +0000
committersleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220>2015-01-19 22:06:24 +0000
commit9537ba5555d494e8ad7145ba552bdc9e1cc46e78 (patch)
treee6485b61679e7ddec7341d4f2572cae51c8fdee9 /navit/binding
parent2b99b024cbc9fabb792d8014bbeeb3125430a2fa (diff)
downloadnavit-svn-9537ba5555d494e8ad7145ba552bdc9e1cc46e78.tar.gz
Fix:binding_dbus:Do not crash if navigation is not configured.|It really helps to read the compiler warnings :-).
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5998 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/binding')
-rw-r--r--navit/binding/dbus/binding_dbus.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/navit/binding/dbus/binding_dbus.c b/navit/binding/dbus/binding_dbus.c
index 36d3fb07..3244bd69 100644
--- a/navit/binding/dbus/binding_dbus.c
+++ b/navit/binding/dbus/binding_dbus.c
@@ -362,6 +362,12 @@ dbus_error_invalid_object_path_parameter(DBusConnection *connection, DBusMessage
}
static DBusHandlerResult
+dbus_error_navigation_not_configured(DBusConnection *connection, DBusMessage *message)
+{
+ return dbus_error(connection, message, DBUS_ERROR_FAILED, "navigation is not configured (no <navigation> element in config file?)");
+}
+
+static DBusHandlerResult
dbus_error_no_data_available(DBusConnection *connection, DBusMessage *message)
{
#if 1
@@ -1313,10 +1319,14 @@ request_navit_route_export_gpx(DBusConnection *connection, DBusMessage *message)
pp=&p;
}
+ struct navigation *nav = navit_get_navigation(navit);
+ if(!nav) {
+ return dbus_error_navigation_not_configured(connection, message);
+ }
+
dbg(lvl_debug,"Dumping route from dbus to %s\n", filename);
struct map * map=NULL;
- struct navigation * nav = NULL;
struct map_rect * mr=NULL;
struct item *item = NULL;
struct attr attr,route;
@@ -1333,10 +1343,6 @@ request_navit_route_export_gpx(DBusConnection *connection, DBusMessage *message)
"<rte>\n";
char *trailer = "</rte>\n</gpx>\n";
- nav = navit_get_navigation(navit);
- if(!nav) {
- return;
- }
map = navigation_get_map(nav);
if(map)
mr = map_rect_new(map,NULL);