Skip to content

Commit 1a44f03

Browse files
committed
Fix index out of range exception
1 parent ef8a553 commit 1a44f03

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Source/RunActivity/Viewer3D/RollingStock/MSTSLocomotiveViewer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,7 @@ public CabRenderer(Viewer viewer, MSTSLocomotive car)
10981098

10991099
#region Create Control renderers
11001100
ControlMap = new Dictionary<int, CabViewControlRenderer>();
1101-
int[] count = new int[256];//enough to hold all types, count the occurence of each type
1101+
int[] count = new int[Enum.GetNames(typeof(CABViewControlTypes)).Length];//enough to hold all types, count the occurence of each type
11021102
var i = 0;
11031103
foreach (var cabView in car.CabViewList)
11041104
{
@@ -1241,7 +1241,7 @@ public CabRenderer(Viewer viewer, MSTSLocomotive car, CabViewFile CVFFile) //use
12411241

12421242
#region Create Control renderers
12431243
ControlMap = new Dictionary<int, CabViewControlRenderer>();
1244-
int[] count = new int[256];//enough to hold all types, count the occurence of each type
1244+
int[] count = new int[Enum.GetNames(typeof(CABViewControlTypes)).Length];//enough to hold all types, count the occurence of each type
12451245
var i = 0;
12461246

12471247
var controlSortIndex = 1; // Controls are drawn atop the cabview and in order they appear in the CVF file.

0 commit comments

Comments
 (0)