OpenBVE icon indicating copy to clipboard operation
OpenBVE copied to clipboard

NullPointerException in StartLoopEx

Open zbx1425 opened this issue 4 years ago • 2 comments

Description

A new player reported that OpenBVE crashes when he attempts to load any route. The crash log was incredibly short:

2020/11/13 21:50:51
OpenBVE 1.7.2.0 Crash Log
Program is running on the Windows backend
Current screen resolution is: Full-screen 1024px X 768px 32bit color-mode
Current routefile is: 
Current train is: 
The current routefile caused the following exception: 
System.NullReferenceException: 未将对象引用设置到对象的实例。
   在 OpenBve.MainLoop.StartLoopEx(MainDialogResult result)
   在 OpenBve.Program.Main(String[] args)   在 System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
   在 System.Environment.get_StackTrace()
   在 OpenBve.Program.Main(String[] args)
Current program memory usage: 42.19mb
System memory free: 3701mb

It seems that the global crash handler crashed, which prevented the actual crash being logged. Screen record of the issue occuring: https://cowtransfer.com/s/084be4c0cbc744

Reproduction

It can be reproduced every time on his computer. The exact way to reproduce on other machines is yet to know. Screen record regarding the way the route is installed: https://cowtransfer.com/s/46f496bcc01547 (I cannot see a problem here)

Route

The route used for reproduction was https://cowtransfer.com/s/fbc3c70fdb694a

Logs

https://cowtransfer.com/s/fad83d95801347

Related information

Windows 10 Keyboard

zbx1425 avatar Nov 14 '20 15:11 zbx1425

It looks to me more like the global crash handler is catching the crash, but nothing is there. I get the feeling the real crash has been caught somewhere else, but not rethrown, and this has left something null that shouldn't be....

It's somewhat odd, as it's not even getting as far as the route loading plugin, but this is clearly working (as the main menu preview works) That means it must be before it hits this function, as otherwise the log would contain the results of it trying to find the railway folder: https://github.com/leezer3/OpenBVE/blob/master/source/OpenBVE/System/Loading.cs#L202

leezer3 avatar Nov 14 '20 16:11 leezer3

I can't reproduce at the minute, and haven't got too many ideas.

However, I've added a little bit more logging and an unrelated fix:

  • Should print after the renderer inits
  • Should also print how many plugins it thinks it's got available
  • Fixed an unrelated issue in the loading screen (this produces a different crash if an invalid character is in the path)

A further log from today's build will narrow down a bit where the thing is actually crashing.

leezer3 avatar Nov 14 '20 16:11 leezer3