Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
If you use the purge all option in the GUI settings, an exception is thrown:
Causes
Contents
tab has a poor public interface, with two ways to change the active mod, theSelectedModule
property andUpdateModContentsTree
UpdateModContentsTree
has amodule
parameter, which is malsuited to this function's usage, which is simply to refresh the currently displayed mod after caching or purging, which requires calling code to do unnecessary work to retrieve and pass the currently shown modUpdateModContentsTree
assumes that itsCkanModule
parameter will never benull
SettingsDialog
passes that parameter asnull
after purging, to try to refresh the display in case a previously cached mod is shown, because it seemed like a natural way to request an operation on the same modChanges
Contents
tab has onlySelectedModule
for setting the mod, andUpdateModContentsTree
is replaced by a newRefresh
function for refreshing, which importantly does not have a module parameter and only re-uses the currently displayed oneMain.UpdateModContentsTree
andModInfo.UpdateModContentsTree
are replaced by zero-parameter functionsMain.RefreshModContentsTree
andModInfo.RefreshModContentsTree
callingContents.Refresh
UpdateModContentsTree
are replaced by calls toRefresh
, which eliminates the possibility of a null reference exceptionFixes #3809.
@GreenKeldeo, a few minutes after this is submitted, assuming there are no compile errors or failed tests, there should be a test build here under the Artifacts dropdown of the Contents tab, if you'd like try out the fix.