mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-07 05:50:54 +07:00
Fix crash when there's no sectors on planet (#5202)
`sectors.size - 1` is `-1` when there's no sectors on planet. relevant crash log: ``` [E] java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 16 at arc.struct.Seq.get(Seq.java:451) at mindustry.type.Planet.getLastSector(Planet.java:114) at mindustry.ui.dialogs.PlanetDialog.show(PlanetDialog.java:185) ... at mindustry.desktop.DesktopLauncher.main(DesktopLauncher.java:36) ```
This commit is contained in:
parent
622f735953
commit
c53e14dd31
@ -111,6 +111,9 @@ public class Planet extends UnlockableContent{
|
||||
}
|
||||
|
||||
public @Nullable Sector getLastSector(){
|
||||
if(sectors.isEmpty()){
|
||||
return null;
|
||||
}
|
||||
return sectors.get(Math.min(Core.settings.getInt(name + "-last-sector", startSector), sectors.size - 1));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user