Skip to content

Commit

Permalink
Fix crash when viewing worlds with missing level.dat data
Browse files Browse the repository at this point in the history
  • Loading branch information
tryashtar committed Jul 8, 2019
1 parent 26472b2 commit 6bf83a5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Image Map 2/WorldControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ public WorldControl(string worldfolder, Edition edition)
string leveldat = Path.Combine(worldfolder, "level.dat");
if (File.Exists(leveldat))
{
var nbtfile = new fNbt.NbtFile(leveldat);
name = nbtfile.RootTag["Data"]["LevelName"].StringValue;
try
{
var nbtfile = new fNbt.NbtFile(leveldat);
name = nbtfile.RootTag["Data"]?["LevelName"]?.StringValue;
}
catch { }
}
}
else
Expand Down

0 comments on commit 6bf83a5

Please sign in to comment.