Skip to content

NullReferenceException when opening the SettingsDialog #2340

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

Closed
KDERazorback opened this issue Mar 3, 2018 · 1 comment
Closed

NullReferenceException when opening the SettingsDialog #2340

KDERazorback opened this issue Mar 3, 2018 · 1 comment
Labels
Duplicate Duplicate of another issue

Comments

@KDERazorback
Copy link

Background

CKAN Version: 1.24.0

KSP Version: 1.3.0.1804

Operating System: Windows 10 Pro

Have you made any manual changes to your GameData folder (i.e., not via CKAN)? No

Problem

What steps did you take in CKAN? Opened the Settings dialog from the Settings menu at the top of the main Form after updating from an old version.

What did you expect to happen? The Settings form is opened and fully populated with the current settings.

What happened instead? A NullReferenceException ocurred at CKAN.SettingsDialog.RefreshAuthTokensListBox() method. This is because the dev forgot to put an additional check when accessing the Windows Registry for any stored AuthTokens, that checks if the actual Windows Key (path) exists before trying to access it in a foreach loop. After you click on Continue, on the Unhadled Exception dialog, the Settings window dont get populated anymore.

Steps to reproduce: Simply remove the HKEY_CURRENT_USER\Software\CKAN\AuthTokens key from the registry and the issue will appear the next time CKAN settings dialog is opened.

Steps to solve: Simply add a Try...Catch around the foreach loop inside the CKAN.SettingsDialog.RefreshAuthTokensListBox() method, or return an empty collection instead of a null value (a simple List(0) would do the trick) at **CKAN.Win32Registry.GetAuthTokenHosts() when the queried RegistryKey object doesnt contain any data at all.

CKAN error codes (if applicable): NullReferenceException

@HebaruSan HebaruSan added the Duplicate Duplicate of another issue label Mar 3, 2018
@HebaruSan
Copy link
Member

Yup, I believe this was the first bug report on the new version.
Duplicate of #2300, fixed in #2301.
As a workaround, you can run ckan authtoken add abcd efgh from the command line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Duplicate of another issue
Projects
None yet
Development

No branches or pull requests

2 participants