[skottie] Fix spurious gradient error messages
The adapter apply() method can get called before stops resolution, so
only log when some stops are present.
TBR=
Change-Id: I8e336e2cff781a0e64de31e6b63f3cf373b2daa0
Reviewed-on: https://skia-review.googlesource.com/140245
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
diff --git a/modules/skottie/src/SkottieAdapter.cpp b/modules/skottie/src/SkottieAdapter.cpp
index 615390e..f4bb0a8 100644
--- a/modules/skottie/src/SkottieAdapter.cpp
+++ b/modules/skottie/src/SkottieAdapter.cpp
@@ -94,7 +94,10 @@
// |fColorStops| holds |fStopCount| x [ pos, r, g, g ] + ? x [ pos, alpha ]
if (fColorStops.size() < fStopCount * 4 || ((fColorStops.size() - fStopCount * 4) % 2)) {
- SkDebugf("!! Invalid gradient stop array size: %zu", fColorStops.size());
+ // apply() may get called before the stops are set, so only log when we have some stops.
+ if (!fColorStops.empty()) {
+ SkDebugf("!! Invalid gradient stop array size: %zu\n", fColorStops.size());
+ }
return;
}