Fix fuzzRange
authorKevin Lubick <kjlubick@google.com>
Tue, 29 Nov 2016 16:25:52 +0000 (11:25 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Tue, 29 Nov 2016 18:29:03 +0000 (18:29 +0000)
Make the fuzzRange not crash if min == max, just set n to be min.

BUG=skia:

Change-Id: I138cefbec9b408d3b35e4258d770e6b396af0e5f
Reviewed-on: https://skia-review.googlesource.com/5305
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Kevin Lubick <kjlubick@google.com>

fuzz/Fuzz.h

index 8abbb22..800a9f1 100644 (file)
@@ -95,7 +95,11 @@ inline void Fuzz::nextRange(float* f, float min, float max) {
 template <typename T, typename Min, typename Max>
 inline void Fuzz::nextRange(T* n, Min min, Max max) {
     this->next<T>(n);
-    if (min >= max) {
+    if (min == max) {
+        *n = min;
+        return;
+    }
+    if (min > max) {
         // Avoid misuse of nextRange
         this->signalBug();
     }