aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2015-04-07 08:48:38 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-04-07 08:48:39 -0700
commit0ea6d7150eb661f51f736ec32ce6fe3fd9922e97 (patch)
tree013e7d03d76e03cb652ca13c6540dfacf42f567c
parentb7e8d69fc21a3043348fd9b76876471e0a6ae7fe (diff)
Fix DM -r
source_options isn't always present. BUG=skia: Review URL: https://codereview.chromium.org/1067863002
-rw-r--r--dm/DMJsonWriter.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/dm/DMJsonWriter.cpp b/dm/DMJsonWriter.cpp
index 4fe6924327..04ae2cea8a 100644
--- a/dm/DMJsonWriter.cpp
+++ b/dm/DMJsonWriter.cpp
@@ -110,12 +110,15 @@ bool JsonWriter::ReadJson(const char* path, void(*callback)(BitmapResult)) {
BitmapResult br;
for (unsigned i = 0; i < results.size(); i++) {
const Json::Value& r = results[i];
- br.name = r["key"]["name"].asCString();
- br.config = r["key"]["config"].asCString();
- br.sourceType = r["key"]["source_type"].asCString();
- br.sourceOptions = r["key"]["source_options"].asCString();
- br.ext = r["options"]["ext"].asCString();
- br.md5 = r["md5"].asCString();
+ br.name = r["key"]["name"].asCString();
+ br.config = r["key"]["config"].asCString();
+ br.sourceType = r["key"]["source_type"].asCString();
+ br.ext = r["options"]["ext"].asCString();
+ br.md5 = r["md5"].asCString();
+
+ if (!r["key"]["source_options"].isNull()) {
+ br.sourceOptions = r["key"]["source_options"].asCString();
+ }
callback(br);
}
return true;