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

Fix NRE on trying to update all when there's nothing to update #4054

Merged
merged 1 commit into from
Mar 10, 2024

Conversation

HebaruSan
Copy link
Member

@HebaruSan HebaruSan commented Mar 10, 2024

Problem

  1. Set up a repo with an invalid URL as your only repo
  2. Close CKAN
  3. Start CKAN
  4. The failed downloads window will appear. Click abort.
  5. Now you have an empty mod list
    (The above steps are just one specific way that I've found to get to this point. It may or may not be how other users might get here, but the below problem happens regardless of the specific path taken.)
  6. Click Update all even though there are no mods to update
  7. An NRE is thrown

Cause

ManageMods.mainModList.full_list_of_mod_rows is null when the grid is empty, and ManageMods.MarkAllUpdates accesses its .Values property.

Changes

  • Now ManageMods.mainModList.full_list_of_mod_rows is set to an empty dictionary on initialization, so it can always be accessed safely, and clicking the button with an empty list will do nothing.
  • A foreach loop in ManageMods.ChangeSetUpdated now uses a deconstructor to get the key and value separately instead of a kvp variable to represent the key value pair. This isn't needed to fix anything, but it's nice for readability.

Fixes #4053.

@HebaruSan HebaruSan added Bug Something is not working as intended Easy This is easy to fix GUI Issues affecting the interactive GUI labels Mar 10, 2024
@HebaruSan HebaruSan merged commit 7b66b1e into KSP-CKAN:master Mar 10, 2024
8 checks passed
@HebaruSan HebaruSan deleted the fix/upgrade-all-nre branch March 10, 2024 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is not working as intended Easy This is easy to fix GUI Issues affecting the interactive GUI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: NRE in MarkAllUpdates
1 participant