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

Unified Diff: include/core/SkPathEffect.h

Issue 1719993002: fix misc asserts and checks found by fuzzer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: hide the creation of the typeface as well Created 4 years, 10 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 | include/effects/Sk1DPathEffect.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPathEffect.h
diff --git a/include/core/SkPathEffect.h b/include/core/SkPathEffect.h
index bd68c8fa728bac5604e5f140537cef6d4f879fcd..a77b9467e42fda294329976e6fddf6f2ce436fe6 100644
--- a/include/core/SkPathEffect.h
+++ b/include/core/SkPathEffect.h
@@ -183,7 +183,13 @@ public:
The reference counts for outer and inner are both incremented in the constructor,
and decremented in the destructor.
*/
- static SkComposePathEffect* Create(SkPathEffect* outer, SkPathEffect* inner) {
+ static SkPathEffect* Create(SkPathEffect* outer, SkPathEffect* inner) {
+ if (!outer) {
+ return SkSafeRef(inner);
+ }
+ if (!inner) {
+ return SkSafeRef(outer);
+ }
return new SkComposePathEffect(outer, inner);
}
@@ -220,7 +226,13 @@ public:
The reference counts for first and second are both incremented in the constructor,
and decremented in the destructor.
*/
- static SkSumPathEffect* Create(SkPathEffect* first, SkPathEffect* second) {
+ static SkPathEffect* Create(SkPathEffect* first, SkPathEffect* second) {
+ if (!first) {
+ return SkSafeRef(second);
+ }
+ if (!second) {
+ return SkSafeRef(first);
+ }
return new SkSumPathEffect(first, second);
}
« no previous file with comments | « no previous file | include/effects/Sk1DPathEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698