diff options
-rw-r--r-- | backends/graphics/openglsdl/openglsdl-graphics.cpp | 5 | ||||
-rw-r--r-- | backends/graphics/surfacesdl/surfacesdl-graphics.cpp | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp index 9b25f43f39..ccb2572d33 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.cpp +++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp @@ -625,7 +625,10 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) { if (event.kbd.keycode == Common::KEYCODE_s) { Common::String filename; - Common::String screenshotsPath = ((OSystem_SDL *)g_system)->getScreenshotsPath(); + Common::String screenshotsPath; + OSystem_SDL *sdl_g_system = dynamic_cast<OSystem_SDL*>(g_system); + if (sdl_g_system) + screenshotsPath = sdl_g_system->getScreenshotsPath(); for (int n = 0;; n++) { SDL_RWops *file; diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index 047941cb43..dd28f32bdc 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -2526,7 +2526,10 @@ bool SurfaceSdlGraphicsManager::notifyEvent(const Common::Event &event) { if (event.kbd.hasFlags(Common::KBD_ALT) && event.kbd.keycode == 's') { Common::String filename; - Common::String screenshotsPath = ((OSystem_SDL *)g_system)->getScreenshotsPath(); + Common::String screenshotsPath; + OSystem_SDL *sdl_g_system = dynamic_cast<OSystem_SDL*>(g_system); + if (sdl_g_system) + screenshotsPath = sdl_g_system->getScreenshotsPath(); for (int n = 0;; n++) { SDL_RWops *file; |