diff options
author | robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-02-07 20:39:40 +0000 |
---|---|---|
committer | robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-02-07 20:39:40 +0000 |
commit | 2d40ec4e9a3fb3540756fa45a6cffd541ada2c78 (patch) | |
tree | 9a20d3ddfbe492435713d3a413c3b39c4e5fea10 /debugger/QT | |
parent | 53009ba7019cbe86a6ab2aa5b7ae5893e4efffbd (diff) |
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
Diffstat (limited to 'debugger/QT')
-rw-r--r-- | debugger/QT/SkDebuggerGUI.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/debugger/QT/SkDebuggerGUI.cpp b/debugger/QT/SkDebuggerGUI.cpp index 890c607bb8..a823c19f90 100644 --- a/debugger/QT/SkDebuggerGUI.cpp +++ b/debugger/QT/SkDebuggerGUI.cpp @@ -1001,7 +1001,16 @@ void SkDebuggerGUI::loadPicture(const SkString& fileName) { 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); |