Skip to content
This repository was archived by the owner on Jan 16, 2024. It is now read-only.

Commit febd84c

Browse files
authored
F #102: Check nulls
2 parents e999e86 + f537d3d commit febd84c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/context.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ function waitForContext($checksum)
140140
}
141141

142142
# Terminate the wait-loop only when context.sh is found and changed
143-
if ([string]$contextPaths.contextPath -ne "" -and (Test-Path $contextPaths.contextPath)) {
143+
if (![string]::IsNullOrEmpty($contextPaths.contextPath) -and (Test-Path $contextPaths.contextPath)) {
144144

145145
# Context must differ
146146
if (contextChanged $contextPaths.contextPath $checksum) {
@@ -1194,15 +1194,15 @@ function ejectContextCD($cdrom_drive)
11941194

11951195
function removeFile($file)
11961196
{
1197-
if ($file -ne "" -and (Test-Path $file)) {
1197+
if (![string]::IsNullOrEmpty($file) -and (Test-Path $file)) {
11981198
logmsg "* Removing the file: ${file}"
11991199
Remove-Item -Path $file -Force
12001200
}
12011201
}
12021202

12031203
function removeDir($dir)
12041204
{
1205-
if ($dir -ne "" -and (Test-Path $dir)) {
1205+
if (![string]::IsNullOrEmpty($dir) -and (Test-Path $dir)) {
12061206
logmsg "* Removing the directory: ${dir}"
12071207
Remove-Item -Path $dir -Recurse -Force
12081208
}

0 commit comments

Comments
 (0)