pdfviewer: fix condition for element in array, reset back the default color to white, and verify type before value in PDF API mapper
Review URL: https://codereview.chromium.org/21017004
git-svn-id: http://skia.googlecode.com/svn/trunk@10427 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/experimental/PdfViewer/generate_code.py b/experimental/PdfViewer/generate_code.py
index 75d3022..23a8360 100644
--- a/experimental/PdfViewer/generate_code.py
+++ b/experimental/PdfViewer/generate_code.py
@@ -518,7 +518,7 @@
cntMust = cntMust + 1
fileMapperNativeCpp.write(' if (!nativeObj->isDictionary()) return false;\n')
fileMapperNativeCpp.write(' ret = nativeObj->get(\"' + prop.fName + '\", \"' + prop.fAbr + '\");\n')
- fileMapperNativeCpp.write(' if (ret == NULL) return false;\n')
+ fileMapperNativeCpp.write(' if (ret == NULL || !' + knowTypes[prop.fTypes.strip()][3] + ') return false;\n')
eval = '';
# TODO(edisonn): this could get out of hand, and could have poor performance if continued on this path