Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #2032 from christav/storage-fix-2028

Fix for 2028 - check for current subscription before accessing it
  • Loading branch information...
commit 19b2400b502279d1996781bb3b3f5d1e650164a8 2 parents 870af45 + 0d0fbc7
Chris Tavares christav authored
2  WindowsAzurePowershell/src/Commands.Storage/Common/StorageCloudCmdletBase.cs
View
@@ -126,7 +126,7 @@ protected override void InitChannelCurrentSubscription(bool force)
internal virtual bool ShouldInitServiceChannel()
{
//Storage Context is empty and have already set the current storage account in subscription
- if (Context == null && CurrentSubscription != null &&
+ if (Context == null && HasCurrentSubscription && CurrentSubscription != null &&
!String.IsNullOrEmpty(CurrentSubscription.CurrentStorageAccountName))
{
return true;
5 WindowsAzurePowershell/src/Commands.Utilities/Common/CmdletWithSubscriptionBase.cs
View
@@ -57,6 +57,11 @@ public WindowsAzureSubscription CurrentSubscription
}
}
+ public bool HasCurrentSubscription
+ {
+ get { return currentSubscription != null || Profile.CurrentSubscription != null; }
+ }
+
private WindowsAzureSubscription ThrowIfNull(WindowsAzureSubscription subscription)
{
if (subscription != null) return subscription;
Please sign in to comment.
Something went wrong with that request. Please try again.