Index: bench/DeferredSurfaceCopyBench.cpp |
diff --git a/bench/DeferredSurfaceCopyBench.cpp b/bench/DeferredSurfaceCopyBench.cpp |
index cbf98ec8a195c313835d3ebd2b1e552dc3ab2c75..e1c3e3b50683bf6a69abe028646cc61b72d7057c 100644 |
--- a/bench/DeferredSurfaceCopyBench.cpp |
+++ b/bench/DeferredSurfaceCopyBench.cpp |
@@ -38,6 +38,13 @@ protected: |
const SkRect fullCanvasRect = SkRect::MakeWH( |
SkIntToScalar(kSurfaceWidth), SkIntToScalar(kSurfaceHeight)); |
SkAutoTUnref<SkSurface> surface(canvas->newSurface(info)); |
+ |
+ // newSurface() can return NULL for several reasons, so we need to check |
+ if (NULL == surface.get()) { |
+ SkDebugf("DeferredSurfaceCopyBench newSurface failed, bench results are meaningless\n"); |
+ return; // should we signal the caller that we hit an error? |
+ } |
+ |
SkAutoTUnref<SkDeferredCanvas> drawingCanvas(SkDeferredCanvas::Create(surface)); |
for (int iteration = 0; iteration < loops; iteration++) { |