[Applications.Common] Add an exception (#913)
authorhjhun <36876573+hjhun@users.noreply.github.com>
Tue, 2 Jul 2019 07:47:46 +0000 (16:47 +0900)
committerpjh9216 <jh9216.park@samsung.com>
Tue, 2 Jul 2019 07:47:46 +0000 (16:47 +0900)
If the interval is less than or equal to zero, or greater than integer
maximum value, ArgumentException is occurred.

Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/Tizen.Applications.Common/Tizen.Applications/CoreApplication.cs

index 52ffff9..a173a0f 100755 (executable)
@@ -174,7 +174,11 @@ namespace Tizen.Applications
         protected virtual void OnLowMemory(LowMemoryEventArgs e)
         {
             LowMemory?.Invoke(this, e);
-            sTimer = new Timer(new Random().Next(10 * 1000));
+            double interval = new Random().Next(10 * 1000);
+            if (interval <= 0)
+                interval = 10 * 1000;
+
+            sTimer = new Timer(interval);
             sTimer.Elapsed += OnTimedEvent;
             sTimer.AutoReset = false;
             sTimer.Enabled = true;