From 1a05359193cd7710cbb54b2d2bca60884f3f52e9 Mon Sep 17 00:00:00 2001 From: Gal Szkolnik Date: Tue, 29 Jun 2021 22:46:33 +0000 Subject: [PATCH] =Fix SessionData Get bug when persistent storage doesn't exist yet --- Setup-ScriptEnv.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Setup-ScriptEnv.ps1 b/Setup-ScriptEnv.ps1 index 49f9ba0..837f707 100644 --- a/Setup-ScriptEnv.ps1 +++ b/Setup-ScriptEnv.ps1 @@ -104,7 +104,9 @@ class SessionData { static [void] Load() { if( -not [SessionData]::Path ) { [SessionData]::Init() } - [SessionData]::Data = Import-Clixml -Path $([SessionData]::Path) + if( Test-Path $([SessionData]::Path) ) { + [SessionData]::Data = Import-Clixml -Path $([SessionData]::Path) + } } static [void] Set([string]$Name,[object]$Value) {