diff --git a/MGU/Classes/Sector.cs b/MGU/Classes/Sector.cs index 68c0760..cf915f9 100644 --- a/MGU/Classes/Sector.cs +++ b/MGU/Classes/Sector.cs @@ -294,7 +294,12 @@ protected override void OnPaint(PaintEventArgs e) for (int l = 0; l < nroflocations; l++) { lindex = currentGame.GetLocationIconIndex(currentGame.location[this.location[l]]); - e.Graphics.DrawImage(currentGame.Locations.Images[lindex], (currentGame.sectorsize / 2) - ((float)(currentGame.sectorsize / 7.5) * (nroflocations / 2)) + (float)(currentGame.sectorsize / 8) * l, currentGame.sectorsize / 2 - (float)(currentGame.sectorsize / 15), (float)(currentGame.sectorsize / 7.5), (float)(currentGame.sectorsize / 7.5)); + + // Check for valid location icon + if (lindex >= 0 && lindex < currentGame.Locations.Images.Count) + { + e.Graphics.DrawImage(currentGame.Locations.Images[lindex], (currentGame.sectorsize / 2) - ((float)(currentGame.sectorsize / 7.5) * (nroflocations / 2)) + (float)(currentGame.sectorsize / 8) * l, currentGame.sectorsize / 2 - (float)(currentGame.sectorsize / 15), (float)(currentGame.sectorsize / 7.5), (float)(currentGame.sectorsize / 7.5)); + } } //DrawFocus(e.Graphics);