diff src/scripts/boot.lua @ 1144:ab6a48fbdd3c

Fix bug where the compat message crashed love. If in conf.lua `t.screen' is set to false or nil, the OpenGL context will not be initialized, leading to a crash in 'Font::print()' when printing the compat message later on.
author vrld <vrld@vrld.org>
date Wed, 17 Oct 2012 18:36:32 +0200
parents 7338252337c9
children 56a408bf9f9f 2e57cc4b8749 448da0a19ddb
line wrap: on
line diff
--- a/src/scripts/boot.lua	Mon Oct 15 17:13:08 2012 +0200
+++ b/src/scripts/boot.lua	Wed Oct 17 18:36:32 2012 +0200
@@ -319,9 +319,10 @@
 	end
 
 	-- Setup screen here.
+	local has_window = false
 	if c.screen and c.modules.graphics then
 		if love.graphics.checkMode(c.screen.width, c.screen.height, c.screen.fullscreen) or (c.screen.width == 0 and c.screen.height == 0) then
-			assert(love.graphics.setMode(c.screen.width, c.screen.height, c.screen.fullscreen, c.screen.vsync, c.screen.fsaa), "Could not set screen mode")
+			has_window = assert(love.graphics.setMode(c.screen.width, c.screen.height, c.screen.fullscreen, c.screen.vsync, c.screen.fsaa), "Could not set screen mode")
 		else
 			error("Could not set screen mode")
 		end
@@ -364,7 +365,7 @@
 				"The game might still work, but it is not guaranteed.\n" ..
 				"Furthermore, this means one should not judge this game or the engine if not."
 			print(msg)
-			if love.graphics and love.timer and love.event then
+			if has_window and love.timer and love.event then
 				love.event.pump()
 				love.graphics.setBackgroundColor(89, 157, 220)
 				love.graphics.clear()