Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't try to update filters if mod list missing #2654

Merged
merged 1 commit into from
Jan 14, 2019

Conversation

HebaruSan
Copy link
Member

Problem

Since #2617, we occasionally get exceptions at startup:

System.NullReferenceException: Object reference not set to an instance of an object.
   at CKAN.Main._UpdateFilters()
   at CKAN.Util.Invoke[T](T obj, Action action)
   at CKAN.Main.UpdateFilters(Main control)
   at CKAN.Main.<.ctor>b__37_0(MainModList source)
   at CKAN.MainModList.set_ModFilter(GUIModFilter value)
   at CKAN.Main.Filter(GUIModFilter filter)
   at CKAN.Main.CurrentInstanceUpdated()
   at CKAN.Main.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Cause

Now that UpdateModsList runs in a background thread, things that formerly happened afterwards can now run alongside it, including several places that populate the mod filters in the GUI. This calls UpdateFilters, which crashes here if UpdateModsList hasn't set mainModList.full_list_of_mod_rows yet:

var rows = new DataGridViewRow[mainModList.full_list_of_mod_rows.Count];

Changes

Now UpdateFilters treats the existence of mainModList.full_list_of_mod_rows as a prerequisite and quits if it's null.

Fixes #2650.

@HebaruSan HebaruSan added Bug GUI Issues affecting the interactive GUI Pull request labels Jan 10, 2019
@politas politas merged commit 2f38433 into KSP-CKAN:master Jan 14, 2019
@HebaruSan HebaruSan deleted the fix/filter-exception branch January 14, 2019 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug GUI Issues affecting the interactive GUI Pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants