Skip to content

Commit 7a0006c

Browse files
Check for empty file when computing hash
1 parent d72eb04 commit 7a0006c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

internal/classes/DBOps.class.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,8 @@ class DBOpsFile : DBOps {
10931093
[void] RebuildHash() {
10941094
if ($this.Length -gt 0) {
10951095
$this.Hash = [DBOpsHelper]::ToHexString([Security.Cryptography.HashAlgorithm]::Create("MD5").ComputeHash($this.ByteArray))
1096+
} else {
1097+
$this.ThrowException("Hash cannot be computed, file is empty: $($this.Name)", 'InvalidData')
10961098
}
10971099
}
10981100
#Verify that hash is valid

0 commit comments

Comments
 (0)