forked from mirror/OpenTTD
Fix: TextfileWindow called virtual methods before constructor completed. (#11889)
SetStringParameters() was called during widget tree init in the constructor. Calls within a constructor cannot call the derived classes methods. This would result in invalid data being passed to the string system, which could then crash.
This commit is contained in:
@@ -97,6 +97,8 @@ struct BaseSetTextfileWindow : public TextfileWindow {
|
||||
|
||||
BaseSetTextfileWindow(TextfileType file_type, const TBaseSet *baseset, StringID content_type) : TextfileWindow(file_type), baseset(baseset), content_type(content_type)
|
||||
{
|
||||
this->ConstructWindow();
|
||||
|
||||
auto textfile = this->baseset->GetTextfile(file_type);
|
||||
this->LoadTextfile(textfile.value(), BASESET_DIR);
|
||||
}
|
||||
|
Reference in New Issue
Block a user