aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2014-11-11 13:13:35 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-11-11 13:13:35 -0800
commitb969fc0f83528c26c6fdf1cbe8b45fb9a4d8a858 (patch)
tree7cb423ea5f94cb0c3624a59fcabbac23e2b5952f
parentf539b8cdee0204985edca028eec826ee94a0c472 (diff)
notice null colorfilter in legacy unflattening
-rwxr-xr-xsrc/effects/SkColorFilterImageFilter.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/effects/SkColorFilterImageFilter.cpp b/src/effects/SkColorFilterImageFilter.cpp
index 806dd5dd01..012f1329a4 100755
--- a/src/effects/SkColorFilterImageFilter.cpp
+++ b/src/effects/SkColorFilterImageFilter.cpp
@@ -85,9 +85,17 @@ SkColorFilterImageFilter::SkColorFilterImageFilter(SkColorFilter* cf,
}
#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
-SkColorFilterImageFilter::SkColorFilterImageFilter(SkReadBuffer& buffer)
- : INHERITED(1, buffer) {
+SkColorFilterImageFilter::SkColorFilterImageFilter(SkReadBuffer& buffer) : INHERITED(1, buffer) {
fColorFilter = buffer.readColorFilter();
+ // we aren't prepared for this to be NULL, and it can't ever be when we're NOT supporting
+ // SK_SUPPORT_LEGACY_DEEPFLATTENING, as we always go through a factory which can detect
+ // NULL. However, since here we're in the legacy code, we assign a dummy filter so we
+ // don't crash with a null-ptr.
+ if (NULL == fColorFilter) {
+ // colormatrix identity is effectively a no-op
+ fColorFilter = SkColorMatrixFilter::Create(SkColorMatrix());
+ SkASSERT(fColorFilter);
+ }
}
#endif