Cleanup debugger's handling of bad input files
https://codereview.appspot.com/7308062/
git-svn-id: http://skia.googlecode.com/svn/trunk@7654 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/debugger/QT/SkDebuggerGUI.cpp b/debugger/QT/SkDebuggerGUI.cpp
index 890c607..a823c19 100644
--- a/debugger/QT/SkDebuggerGUI.cpp
+++ b/debugger/QT/SkDebuggerGUI.cpp
@@ -1001,7 +1001,16 @@
fFileName = fileName;
fLoading = true;
SkStream* stream = SkNEW_ARGS(SkFILEStream, (fileName.c_str()));
- SkOffsetPicture* picture = SkNEW_ARGS(SkOffsetPicture, (stream, NULL, &SkImageDecoder::DecodeStream));
+
+ bool success = false;
+
+ SkOffsetPicture* picture = SkNEW_ARGS(SkOffsetPicture, (stream, &success, &SkImageDecoder::DecodeStream));
+
+ if (!success) {
+ QMessageBox::critical(this, "Error loading file", "Couldn't read file, sorry.");
+ SkSafeUnref(stream);
+ return;
+ }
fCanvasWidget.resetWidgetTransform();
fDebugger.loadPicture(picture);