mirror of
https://github.com/love2d/love.git
synced 2026-08-13 17:10:54 +02:00
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.
This commit is contained in:
@@ -319,9 +319,10 @@ function love.init()
|
||||
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 @@ function love.init()
|
||||
"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()
|
||||
|
||||
Reference in New Issue
Block a user