summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Leske <sebastian.leske@sleske.name>2016-01-08 08:35:03 +0100
committerSebastian Leske <sebastian.leske@sleske.name>2016-01-11 23:27:38 +0100
commit59f741f634cab4529867e4296276337f03fa8b87 (patch)
tree394aa364800a033a9bf677635e8f35c315391c79
parent12d8bcaf432644b9a926f531f47006fb570f9309 (diff)
downloadnavit-R6534.tar.gz
Fix:core:Exit if GUI or graphics init / connection fails.R6534
If the initialization of GUI or graphics plugin or connecting the two fails, exit immediately. In that state we cannot reliably continue running, plus there's probably no point anyway.
-rw-r--r--navit/graphics/android/graphics_android.c2
-rw-r--r--navit/graphics/sdl/graphics_sdl.c4
-rw-r--r--navit/navit.c16
3 files changed, 9 insertions, 13 deletions
diff --git a/navit/graphics/android/graphics_android.c b/navit/graphics/android/graphics_android.c
index efde8358a..696ee6b3c 100644
--- a/navit/graphics/android/graphics_android.c
+++ b/navit/graphics/android/graphics_android.c
@@ -34,8 +34,6 @@
#include "android.h"
#include "command.h"
-int dummy;
-
struct graphics_priv {
jclass NavitGraphicsClass;
jmethodID NavitGraphics_draw_polyline, NavitGraphics_draw_polygon, NavitGraphics_draw_rectangle,
diff --git a/navit/graphics/sdl/graphics_sdl.c b/navit/graphics/sdl/graphics_sdl.c
index e5d9f7872..886aacd3d 100644
--- a/navit/graphics/sdl/graphics_sdl.c
+++ b/navit/graphics/sdl/graphics_sdl.c
@@ -96,8 +96,6 @@ struct graphics_priv {
/* </main> */
};
-static int dummy;
-
#ifdef USE_WEBOS
# define WEBOS_KEY_SHIFT 0x130
# define WEBOS_KEY_SYM 0x131
@@ -875,7 +873,7 @@ get_data(struct graphics_priv *this, char const *type)
win->disable_suspend=NULL;
return win;
} else {
- return &dummy;
+ return NULL;
}
}
diff --git a/navit/navit.c b/navit/navit.c
index b130ed967..27426fe17 100644
--- a/navit/navit.c
+++ b/navit/navit.c
@@ -2041,22 +2041,22 @@ navit_init(struct navit *this_)
dbg(lvl_info,"enter gui %p graphics %p\n",this_->gui,this_->gra);
if (!this_->gui && !(this_->flags & 2)) {
- dbg(lvl_error,"Warning: No GUI available.\n");
- return;
+ dbg(lvl_error,"FATAL: No GUI available.\n");
+ exit(1);
}
if (!this_->gra && !(this_->flags & 1)) {
- dbg(lvl_error,"Warning: No graphics subsystem available.\n");
- return;
+ dbg(lvl_error,"FATAL: No graphics subsystem available.\n");
+ exit(1);
}
dbg(lvl_info,"Connecting gui to graphics\n");
if (this_->gui && this_->gra && gui_set_graphics(this_->gui, this_->gra)) {
struct attr attr_type_gui, attr_type_graphics;
gui_get_attr(this_->gui, attr_type, &attr_type_gui, NULL);
graphics_get_attr(this_->gra, attr_type, &attr_type_graphics, NULL);
- dbg(lvl_error,"failed to connect graphics '%s' to gui '%s'\n", attr_type_graphics.u.str, attr_type_gui.u.str);
- dbg(lvl_error," Please see http://wiki.navit-project.org/index.php/Failed_to_connect_graphics_to_gui\n");
- dbg(lvl_error," for explanations and solutions\n");
- return;
+ dbg(lvl_error,"FATAL: Failed to connect graphics '%s' to gui '%s'\n", attr_type_graphics.u.str, attr_type_gui.u.str);
+ dbg(lvl_error,"Please see http://wiki.navit-project.org/index.php/Failed_to_connect_graphics_to_gui "
+ "for explanations and solutions\n");
+ exit(1);
}
if (this_->speech && this_->navigation) {
struct attr speech;