mika76 / mamesaver

Mamesaver is a mame emulated screensaver - get all the good ol' games playing their demo modes while you procrastinate and enjoy!
https://mika76.github.io/mamesaver/
MIT License
37 stars 10 forks source link

Layout creation crashes if missing rotation and game unavailable #25

Closed nullpainter closed 6 years ago

nullpainter commented 6 years ago

If the rotation attribute is missing from gamelist.xml and in-game titles are enabled, the rotation is fetched from MAME on game run.

However, this results in a crash if the game was added when the imperfect emulation flag was enabled, but when this flag has been subsequently disabled:

System.NullReferenceException: Object reference not set to an instance of an object.
   at Mamesaver.Layout.LayoutBuilder.GetRotation(Game game) in C:\code\mamesaver-fork\Mamesaver\Layout\LayoutBuilder.cs:line 105
   at Mamesaver.Layout.LayoutBuilder.EnsureLayout(Game game, Int32 monitorWidth, Int32 monitorHeight) in C:\code\mamesaver-fork\Mamesaver\Layout\LayoutBuilder.cs:line 52
   at Mamesaver.MameScreen.RunGame() in C:\code\mamesaver-fork\Mamesaver\MameScreen.cs:line 352
   at Mamesaver.MameScreen.SplashTimerTick(Object sender, EventArgs e) in C:\code\mamesaver-fork\Mamesaver\MameScreen.cs:line 212

A reasonable fix would be to pass a flag to skip the status check when calling GetRomDetails() in-game.