aboutsummaryrefslogtreecommitdiffstats
path: root/src/base
diff options
context:
space:
mode:
authorwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-04-14 13:15:14 +0000
committerwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-04-14 13:15:14 +0000
commit74b2872c860073f7e30dc651da013c16d19ba6c6 (patch)
tree6219a76a592efbb82a2d2d8e0b52d736b4c9f2c5 /src/base
parentf22847f28a975e15e79efb4faafcb480e22e8dcc (diff)
downloadusdx-74b2872c860073f7e30dc651da013c16d19ba6c6.tar.gz
usdx-74b2872c860073f7e30dc651da013c16d19ba6c6.tar.xz
usdx-74b2872c860073f7e30dc651da013c16d19ba6c6.zip
- fix crash when not existing skin is selected in config file
- restrict loading of themes w/o correct version tag 'USD 110' - remove version tag from classic theme because it causes a crash on load due to missing statics and or texts that some screens assume to be there, e.g. score screen git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2239 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src/base')
-rw-r--r--src/base/UIni.pas17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/base/UIni.pas b/src/base/UIni.pas
index 6f875e50..6e86c558 100644
--- a/src/base/UIni.pas
+++ b/src/base/UIni.pas
@@ -721,6 +721,7 @@ var
SearchResult: TSearchRec;
ThemeIni: TMemIniFile;
ThemeName: string;
+ ThemeVersion: string;
I: integer;
Iter: IFileIterator;
FileInfo: TFileInfo;
@@ -737,10 +738,18 @@ begin
Log.LogStatus('Found Theme: ' + FileInfo.Name.ToNative, 'Theme');
//Read Themename from Theme
- ThemeIni := TMemIniFile.Create(FileInfo.Name.ToNative);
+ ThemeIni := TMemIniFile.Create(ThemePath.Append(FileInfo.Name).ToNative);
ThemeName := UpperCase(ThemeIni.ReadString('Theme','Name', FileInfo.Name.SetExtension('').ToNative));
+ ThemeVersion := Trim(UpperCase(ThemeIni.ReadString('Theme','US_Version', 'no version tag')));
ThemeIni.Free;
+ // don't load theme with wrong version tag
+ if ThemeVersion <> 'USD 110' then
+ begin
+ Log.LogWarn('Wrong Version (' + ThemeVersion + ') in Theme : ' + ThemeName, 'Theme');
+ Continue;
+ end;
+
//Search for Skins for this Theme
for I := Low(Skin.Skin) to High(Skin.Skin) do
begin
@@ -767,6 +776,12 @@ begin
Skin.onThemeChange;
SkinNo := GetArrayIndex(ISkin, IniFile.ReadString('Themes', 'Skin', ISkin[0]));
+
+ { there may be a not existing skin in the ini file
+ e.g. due to manual edit or corrupted file.
+ in this case we load the first Skin }
+ if SkinNo = -1 then
+ SkinNo := 0;
end;
procedure TIni.LoadScreenModes(IniFile: TCustomIniFile);