Skip to content

Commit

Permalink
- handle the case where SBARINFO only contains a mugshot definition a…
Browse files Browse the repository at this point in the history
…nd fall back to the current statusbarclass if creating an SBARINFO-based statusbar fails.
  • Loading branch information
coelckers committed May 21, 2017
1 parent e27e89b commit be2cfdd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/g_statusbar/sbarinfo.cpp
Expand Up @@ -1576,8 +1576,7 @@ DEFINE_ACTION_FUNCTION(DSBarInfo, GetProtrusion)
DBaseStatusBar *CreateCustomStatusBar(int scriptno)
{
auto script = SBarInfoScript[scriptno];
if (script == NULL)
I_FatalError("Tried to create a status bar with no script!");
if (script == nullptr) return nullptr;

auto sbar = (DBaseStatusBar*)PClass::FindClass("SBarInfoWrapper")->CreateNew();
auto core = new DSBarInfo(sbar, script);
Expand Down
9 changes: 9 additions & 0 deletions src/g_statusbar/shared_sbar.cpp
Expand Up @@ -303,6 +303,15 @@ void ST_CreateStatusBar(bool bTitleLevel)
{
StatusBar = CreateCustomStatusBar(SCRIPT_DEFAULT);
}
// SBARINFO failed so try the current statusbarclass again.
if (StatusBar == nullptr)
{
auto cls = PClass::FindClass(gameinfo.statusbarclass);
if (cls != nullptr)
{
StatusBar = (DBaseStatusBar *)cls->CreateNew();
}
}
}
if (StatusBar == nullptr)
{
Expand Down

0 comments on commit be2cfdd

Please sign in to comment.