Index: include/core/SkCanvas.h |
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h |
index cfc252fccfc191c64804b4edfd172ba2e9b066e1..dc3953ed4b1df71634992a1bec5bd1d7a85450e3 100644 |
--- a/include/core/SkCanvas.h |
+++ b/include/core/SkCanvas.h |
@@ -1145,11 +1145,12 @@ private: |
*/ |
class SkAutoCanvasRestore : SkNoncopyable { |
public: |
- SkAutoCanvasRestore(SkCanvas* canvas, bool doSave) : fCanvas(canvas) { |
- SkASSERT(canvas); |
- fSaveCount = canvas->getSaveCount(); |
- if (doSave) { |
- canvas->save(); |
+ SkAutoCanvasRestore(SkCanvas* canvas, bool doSave) : fCanvas(canvas), fSaveCount(0) { |
+ if (fCanvas) { |
+ fSaveCount = canvas->getSaveCount(); |
+ if (doSave) { |
+ canvas->save(); |
+ } |
} |
} |
~SkAutoCanvasRestore() { |