diff options
author | David Karlaš <david.karlas@xamarin.com> | 2015-03-02 20:15:04 +0300 |
---|---|---|
committer | David Karlaš <david.karlas@xamarin.com> | 2015-03-02 20:16:29 +0300 |
commit | fc1a939966b3cb7520b1ac741f7dfd24541d9b98 (patch) | |
tree | 997fa78ddcf6430c2c0b2aebd5b600558fa0c87b /main/src/addins/WindowsPlatform | |
parent | fb6a252bb000b15bf89f4f988cc4a84c9054fcae (diff) |
[Windows] Fixing NRE when registry entry is missing for some file extensions
Diffstat (limited to 'main/src/addins/WindowsPlatform')
-rw-r--r-- | main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.cs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.cs index e1da8f4654..798ff15326 100644 --- a/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.cs +++ b/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.cs @@ -344,7 +344,7 @@ namespace MonoDevelop.Platform //first check for the user's preferred app for this file type and use it as the default using (var key = Registry.CurrentUser.OpenSubKey (@"Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" + extension + @"\UserChoice")) { - var progid = key.GetValue ("ProgId") as string; + var progid = key == null ? null : key.GetValue ("ProgId") as string; if (progid != null) apps[progid] = defaultApp = WindowsAppFromName (progid, true, AssociationFlags.None); } @@ -352,6 +352,8 @@ namespace MonoDevelop.Platform //look in all the locatiosn where progids can be registered as handler for files //starting with local user and falling back to system foreach (var key in GetOpenWithProgidsKeys (extension)) { + if (key == null) + continue; using (key) { //if we didn't find a default app yet, check for one if (defaultApp == null) { |