From: Debian Games Team <pkg-games-devel@lists.alioth.debian.org>
Date: Sun, 10 Jul 2016 22:12:47 +0200
Subject: fix_segfault_notebook

---
 src/main.cpp   | 2 +-
 src/window.cpp | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/main.cpp b/src/main.cpp
index 55f65bd..820a1d5 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -184,7 +184,7 @@ int main(int argc, char *argv[]) {
 
 	if (Config.fullscreen) flags |= SDL_FULLSCREEN;
 
-	SDL_Surface *s;
+	SDL_Surface *s = NULL;
 
 	if (!manualres) {
 	    s = Window.OpenWindow(Config.reswidth, Config.resheight, 32, flags);
diff --git a/src/window.cpp b/src/window.cpp
index 7872c9f..8570465 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -53,6 +53,10 @@ SDL_Surface * window::OpenWindow(int w, int h, int b, int flags) {
 
 
 	screen = SDL_SetVideoMode(width, height, bpp, flags);
+
+	if (!screen)
+		return NULL;
+
 	SDL_EventState(SDL_VIDEOEXPOSE, SDL_ENABLE);
 
 	// Set viewport
