diff options
author | sleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2015-01-19 22:06:24 +0000 |
---|---|---|
committer | sleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2015-01-19 22:06:24 +0000 |
commit | 9537ba5555d494e8ad7145ba552bdc9e1cc46e78 (patch) | |
tree | e6485b61679e7ddec7341d4f2572cae51c8fdee9 /navit | |
parent | 2b99b024cbc9fabb792d8014bbeeb3125430a2fa (diff) | |
download | navit-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')
-rw-r--r-- | navit/binding/dbus/binding_dbus.c | 16 | ||||
-rw-r--r-- | navit/navigation.c | 1 |
2 files changed, 11 insertions, 6 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); diff --git a/navit/navigation.c b/navit/navigation.c index b1c5a28b..afb92468 100644 --- a/navit/navigation.c +++ b/navit/navigation.c @@ -1205,7 +1205,6 @@ maneuver_required2(struct navigation *nav, struct navigation_itm *old, struct na { int ret=0,d,dw,dlim,dc; char *r=NULL; - struct navigation_way *w; int cat,ncat,wcat,maxcat,left=-180,right=180,is_unambiguous=0,is_same_street; int curve_limit=25; /* any angle less than this is considered straight */ int junction_limit = 100; /* maximum distance between two carriageways at a junction */ |