Mercurial > hg > orthanc
changeset 2830:ab0fd5923c1d
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 20 Sep 2018 11:07:38 +0200 |
parents | 61fdb06e389a |
children | b51233f03e7e |
files | Core/DicomParsing/FromDcmtkBridge.cpp |
diffstat | 1 files changed, 21 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/Core/DicomParsing/FromDcmtkBridge.cpp Thu Sep 20 10:30:49 2018 +0200 +++ b/Core/DicomParsing/FromDcmtkBridge.cpp Thu Sep 20 11:07:38 2018 +0200 @@ -1714,10 +1714,28 @@ { std::auto_ptr<DcmItem> item(new DcmItem); - Json::Value::Members members = value[i].getMemberNames(); - for (Json::Value::ArrayIndex j = 0; j < members.size(); j++) + switch (value[i].type()) { - item->insert(FromJson(ParseTag(members[j]), value[i][members[j]], decodeDataUriScheme, dicomEncoding)); + case Json::objectValue: + { + Json::Value::Members members = value[i].getMemberNames(); + for (Json::Value::ArrayIndex j = 0; j < members.size(); j++) + { + item->insert(FromJson(ParseTag(members[j]), value[i][members[j]], decodeDataUriScheme, dicomEncoding)); + } + } + + case Json::arrayValue: + // Lua cannot disambiguate between an empty dictionary + // and an empty array + if (value[i].size() != 0) + { + throw OrthancException(ErrorCode_BadParameterType); + } + break; + + default: + throw OrthancException(ErrorCode_BadParameterType); } sequence->append(item.release());