bi: Fix --report SIGSEGV caused by uninitialised video

At some point in 1.17.x, the check for whether the game window
was null disappeared. This brings it back by exposing a check
through the video namespace so as to avoid piggybacking further
on the video::get_window() function, which we are meant to avoid
using.
This commit is contained in:
Iris Morelle 2023-01-21 00:47:57 -03:00 committed by Steve Cotton
parent edbf332d48
commit 1a430b7ecc
3 changed files with 12 additions and 0 deletions

View file

@ -550,6 +550,10 @@ list_formatter video_settings_report_internal(const std::string& heading = "")
placeholder = "Running in non-interactive mode.";
}
if(!video::has_window()) {
placeholder = "Video not initialized yet.";
}
if(!placeholder.empty()) {
fmt.set_placeholder(placeholder);
return fmt;

View file

@ -397,6 +397,11 @@ void init_window()
update_framebuffer();
}
bool has_window()
{
return bool(window);
}
point output_size()
{
if (testing_) {

View file

@ -85,6 +85,9 @@ bool testing();
/* Windowing functions */
/***********************/
/** Whether the game has set up a window to render into */
bool has_window();
/** Whether we are currently in fullscreen mode */
bool is_fullscreen();