Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Unified Diff: src/effects/SkTableColorFilter.cpp

Issue 15824003: check texture is not NULL to aovid segmentation fault. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkTableColorFilter.cpp
===================================================================
--- src/effects/SkTableColorFilter.cpp (revision 9286)
+++ src/effects/SkTableColorFilter.cpp (working copy)
@@ -386,15 +386,18 @@
GrEffectRef* SkTable_ColorFilter::asNewEffect(GrContext* context) const {
SkBitmap bitmap;
+ GrEffectRef* effect = NULL;
this->asComponentTable(&bitmap);
// passing NULL because this effect does no tiling or filtering.
GrTexture* texture = GrLockAndRefCachedBitmapTexture(context, bitmap, NULL);
- GrEffectRef* effect = ColorTableEffect::Create(texture, fFlags);
+ if (NULL != texture) {
+ effect = ColorTableEffect::Create(texture, fFlags);
- // Unlock immediately, this is not great, but we don't have a way of
- // knowing when else to unlock it currently. TODO: Remove this when
- // unref becomes the unlock replacement for all types of textures.
- GrUnlockAndUnrefCachedBitmapTexture(texture);
+ // Unlock immediately, this is not great, but we don't have a way of
+ // knowing when else to unlock it currently. TODO: Remove this when
+ // unref becomes the unlock replacement for all types of textures.
+ GrUnlockAndUnrefCachedBitmapTexture(texture);
+ }
return effect;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698