Fix problem of os_fatal() trying to write to SDL window when SDL not active.
authorDavid Griffith <dave@661.org>
Mon, 24 Jun 2019 00:11:45 +0000 (17:11 -0700)
committerDavid Griffith <dave@661.org>
Mon, 24 Jun 2019 00:11:45 +0000 (17:11 -0700)
commit0e8089432b8f1ef140b19ac24bd46293fb3ff522
tree598aaa57a08c4c5a8b749a02939f8c2041c6e2c0
parent13ded6d374079992310947dd42bff7d2d3145c91
Fix problem of os_fatal() trying to write to SDL window when SDL not active.

If we have a showstopping problem right from the start, like trying to
load a file that's not a Zcode file or Blorb file that lacks a Zcode
chunk, then Frotz will call os_fatal() to complain about it and then
exit.  But sfrotz's version of os_fatal doesn't check if SDL is active
or not before calling functions that depend on SDL.  The first of these
is os_set_text_style().  This leads to a segfault when a call of
current.font->getglyph(current.font,c,1); dereferences getglyph, which
does not exist because current is not properly initialized yet.
src/sdl/sf_frotz.h
src/sdl/sf_resource.c
src/sdl/sf_video.c