Skip to content

Commit 5ff1e73

Browse files
committed
Correction for read DecreaseColor
1 parent 794fddf commit 5ff1e73

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Source/Orts.Formats.Msts/CabViewFile.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -876,11 +876,19 @@ public CVCDigital(STFReader stf, string basepath)
876876
}),
877877
new STFReader.TokenProcessor("decreasecolour", ()=>{
878878
stf.MustMatch("(");
879-
stf.ReadInt(0);
879+
int NumColor = stf.ReadInt(0);
880880
if(stf.EndOfBlock() == false)
881881
{
882-
stf.ParseBlock(new STFReader.TokenProcessor[] {
883-
new STFReader.TokenProcessor("controlcolour", ()=>{ DecreaseColor = ParseControlColor(stf); }) });
882+
if (NumColor == 0)
883+
{
884+
// no. of colors is set as 0 and therefor no color is defined, but if set anyway, it must be skipped
885+
stf.SkipRestOfBlock();
886+
}
887+
else
888+
{
889+
stf.ParseBlock(new STFReader.TokenProcessor[] {
890+
new STFReader.TokenProcessor("controlcolour", ()=>{ DecreaseColor = ParseControlColor(stf); }) });
891+
}
884892
}
885893
}),
886894
new STFReader.TokenProcessor("ortsfont", ()=>{ParseFont(stf); }),

0 commit comments

Comments
 (0)