Skip to content

Commit

Permalink
fix: powershell duration can be $null
Browse files Browse the repository at this point in the history
resolves #236
  • Loading branch information
JanDeDobbeleer committed Dec 14, 2020
1 parent 739dbde commit 3cf90a1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/docs/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ Edit `$PROFILE` in your preferred PowerShell version and add the following lines
$executionTime = -1
$history = Get-History -ErrorAction Ignore -Count 1
if ($null -ne $history) {
if ($null -ne $history -and $null -ne $history.Duration) {
$executionTime = $history.Duration.TotalMilliseconds
}
Expand Down
2 changes: 1 addition & 1 deletion packages/powershell/oh-my-posh/oh-my-posh.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function Set-PoshPrompt {

$executionTime = -1
$history = Get-History -ErrorAction Ignore -Count 1
if ($null -ne $history) {
if ($null -ne $history -and $null -ne $history.Duration) {
$executionTime = $history.Duration.TotalMilliseconds
}

Expand Down

0 comments on commit 3cf90a1

Please sign in to comment.