=Fix SessionData Get bug when persistent storage doesn't exist yet

This commit is contained in:
Gal Szkolnik 2021-06-29 22:46:33 +00:00
parent d33131cd78
commit 1a05359193
1 changed files with 3 additions and 1 deletions

View File

@ -104,7 +104,9 @@ class SessionData {
static [void] Load() { static [void] Load() {
if( -not [SessionData]::Path ) { [SessionData]::Init() } 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) { static [void] Set([string]$Name,[object]$Value) {