From 507a8a6dc9a5a67d4db82c4cdd1bf7d18f241a1c Mon Sep 17 00:00:00 2001 From: mrward Date: Mon, 30 May 2011 19:02:12 +0100 Subject: [PATCH] Fix PowerShell detection error when registry key does not exist. --- .../Project/Src/Scripting/PowerShellDetection.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/AddIns/Misc/PackageManagement/Project/Src/Scripting/PowerShellDetection.cs b/src/AddIns/Misc/PackageManagement/Project/Src/Scripting/PowerShellDetection.cs index 3787a7cc1f..f2643f1432 100644 --- a/src/AddIns/Misc/PackageManagement/Project/Src/Scripting/PowerShellDetection.cs +++ b/src/AddIns/Misc/PackageManagement/Project/Src/Scripting/PowerShellDetection.cs @@ -19,19 +19,20 @@ namespace ICSharpCode.PackageManagement.Scripting public bool IsPowerShell2Installed() { if (!installed.HasValue) { - CheckIfPowerShell2IsInstalled(); + installed = CheckIfPowerShell2IsInstalled(); } return installed.Value; } - void CheckIfPowerShell2IsInstalled() + bool CheckIfPowerShell2IsInstalled() { RegistryKey key = OpenPowerShellRegistryKey(); if (key != null) { using (key) { - installed = IsPowerShell2Installed(key); + return IsPowerShell2Installed(key); } } + return false; } RegistryKey OpenPowerShellRegistryKey()