pdfviewer: fix font rotation issues

Review URL: https://codereview.chromium.org/22407005

git-svn-id: http://skia.googlecode.com/svn/trunk@10617 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp b/experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp
index 333b0a2..2e7e670 100644
--- a/experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp
+++ b/experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp
@@ -90,21 +90,22 @@
         , fRootCatalog(NULL) {
     gDoc = this;
     FILE* file = fopen(path, "r");
-    size_t size = getFileSize(path);
-    void* content = sk_malloc_throw(size);
-    bool ok = (0 != fread(content, size, 1, file));
-    fclose(file);
-    file = NULL;
+    // TODO(edisonn): put this in a function that can return NULL
+    if (file) {
+        size_t size = getFileSize(path);
+        void* content = sk_malloc_throw(size);
+        bool ok = (0 != fread(content, size, 1, file));
+        fclose(file);
+        if (!ok) {
+            sk_free(content);
+            // TODO(edisonn): report read error
+            // TODO(edisonn): not nice to return like this from constructor, create a static
+            // function that can report NULL for failures.
+            return;  // Doc will have 0 pages
+        }
 
-    if (!ok) {
-        sk_free(content);
-        // TODO(edisonn): report read error
-        // TODO(edisonn): not nice to return like this from constructor, create a static
-        // function that can report NULL for failures.
-        return;  // Doc will have 0 pages
+        init(content, size);
     }
-
-    init(content, size);
 }
 
 void SkNativeParsedPDF::init(const void* bytes, size_t length) {