Skip to content

Commit

Permalink
Return null on division by zero
Browse files Browse the repository at this point in the history
  • Loading branch information
Bond-009 committed Dec 18, 2021
1 parent f8fcbc8 commit 968c534
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,7 @@ private bool IsClose(double d1, double d2, double variance = .005)
return null;
}

return divisor == 0f ? 0f : dividend / divisor;
return divisor == 0f ? null : dividend / divisor;
}

private void SetAudioRuntimeTicks(InternalMediaInfoResult result, MediaInfo data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class ProbeResultNormalizerTests
[InlineData("25/1", 25f)]
[InlineData("120/1", 120f)]
[InlineData("1704753000/71073479", 23.98578237601117f)]
[InlineData("0/0", 0f)]
[InlineData("0/0", null)]
[InlineData("1/1000", 0.001f)]
[InlineData("1/90000", 1.1111111E-05f)]
[InlineData("1/48000", 2.0833333E-05f)]
Expand Down

0 comments on commit 968c534

Please sign in to comment.