NullReferenceException when setting MSTS installation path

Bug #1680412 reported by Tejesember
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Open Rails
Fix Released
Undecided
Unassigned

Bug Description

Steps to reproduce:
I made a clean install with the 1.2 installer
It pops up the Options Content page, and when I chose the path of MSTS, press OK, this arises:

System.NullReferenceException: Object reference not set to an instance of an object.
   at ORTS.OptionsForm.buttonContentBrowse_Click(Object sender, EventArgs e) in e:\Documents\Coding\Jenkins\jobs\Open Rails Unstable\workspace\Source\Menu\Options.cs:line 650
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

This happens with instable channel, and locally built SVN r3822 as well.
Looks like ORTS.OptionsForm.bindingSourceContent.Current is null or not ContentFolder.

Revision history for this message
Tejesember (tejes) wrote :

I've got some time to further investigate the problem, and I created a patch fixing it too.

The bug occurred only when OR could not find the MSTS path in the registry, and there was no content folder added either. The datagrid is therefore empty, but the browse button is not disabled, its event handler tries to access the current selection in the datagrid upon selecting something, but it is null.
My solution is pretty straightforward, check for entries in the OptionsForm constructor and disable the browse button and name textfield if necessary. Also added a null check in the folder browser's event handler, just in case.

Revision history for this message
Derek Morton (derek-a) wrote :

no feedback

Changed in or:
status: New → Fix Released
James Ross (twpol)
Changed in or:
milestone: none → 1.4
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.