mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-13 09:39:10 +00:00
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:
@@ -43,6 +43,8 @@ struct ContentTextfileWindow : public TextfileWindow {
|
||||
|
||||
ContentTextfileWindow(TextfileType file_type, const ContentInfo *ci) : TextfileWindow(file_type), ci(ci)
|
||||
{
|
||||
this->ConstructWindow();
|
||||
|
||||
auto textfile = this->ci->GetTextfile(file_type);
|
||||
this->LoadTextfile(textfile.value(), GetContentInfoSubDir(this->ci->type));
|
||||
}
|
||||
|
Reference in New Issue
Block a user