Skip to content

Commit

Permalink
Vibrate - Detect zero duration and return early (#11314)
Browse files Browse the repository at this point in the history
* Detect zero duration and return early

* Check for < 0 condition as well

Co-authored-by: Jonathan Dick <jondick@gmail.com>
  • Loading branch information
BioTurboNick and Redth committed Dec 12, 2022
1 parent 505e10f commit a63b120
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Essentials/src/Vibration/Vibration.android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ void PlatformVibrate(TimeSpan duration)
Permissions.EnsureDeclared<Permissions.Vibrate>();

var time = (long)duration.TotalMilliseconds;
if (time <= 0)
return;
#if __ANDROID_26__
if (OperatingSystem.IsAndroidVersionAtLeast(26))
{
Expand Down

0 comments on commit a63b120

Please sign in to comment.