diff options
Diffstat (limited to 'src/core/SkColorFilter.cpp')
-rw-r--r-- | src/core/SkColorFilter.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/core/SkColorFilter.cpp b/src/core/SkColorFilter.cpp index f6b86c5aa9..5362c1aca7 100644 --- a/src/core/SkColorFilter.cpp +++ b/src/core/SkColorFilter.cpp @@ -261,11 +261,10 @@ private: sk_sp<SkFlattenable> SkSRGBGammaColorFilter::CreateProc(SkReadBuffer& buffer) { uint32_t dir = buffer.read32(); - if (dir <= 1) { - return sk_sp<SkFlattenable>(new SkSRGBGammaColorFilter(static_cast<Direction>(dir))); + if (!buffer.validate(dir <= 1)) { + return nullptr; } - buffer.validate(false); - return nullptr; + return sk_sp<SkFlattenable>(new SkSRGBGammaColorFilter(static_cast<Direction>(dir))); } void SkSRGBGammaColorFilter::toString(SkString* str) const { |