Index: include/private/SkTemplates.h |
diff --git a/include/private/SkTemplates.h b/include/private/SkTemplates.h |
index 7e2c19f09daa199486462e0410f64a79a58cce2c..3ca5978cbb5578561e59db28b5e123d57b6bf23f 100644 |
--- a/include/private/SkTemplates.h |
+++ b/include/private/SkTemplates.h |
@@ -326,8 +326,11 @@ public: |
SkAutoSTMalloc(size_t count) { |
if (count > kCount) { |
fPtr = (T*)sk_malloc_flags(count * sizeof(T), SK_MALLOC_THROW | SK_MALLOC_TEMP); |
- } else { |
+ } else if (count > 0) { |
fPtr = fTStorage; |
+ } else { |
+ SkASSERT(0 == count); |
reed1
2016/06/22 11:33:30
Can this ever not be true?
csmartdalton
2016/06/23 17:07:46
The idea would be that if somebody unintentionally
reed1
2016/06/23 17:44:36
but count is size_t, which will never appear to be
csmartdalton
2016/06/23 18:07:26
Yeah, I realized it was size_t after the fact :)
|
+ fPtr = nullptr; |
} |
} |
@@ -344,8 +347,11 @@ public: |
} |
if (count > kCount) { |
fPtr = (T*)sk_malloc_throw(count * sizeof(T)); |
- } else { |
+ } else if (count > 0) { |
fPtr = fTStorage; |
+ } else { |
+ SkASSERT(0 == count); |
+ fPtr = nullptr; |
} |
return fPtr; |
} |