# HG changeset patch # User Sebastien Jodogne # Date 1542035262 -3600 # Node ID 3aa058dcd5fb2cabca799bdcfba801897107ed13 # Parent 6decc0ba9da5da10b77c186f64aea05b01fb2661 fix diff -r 6decc0ba9da5 -r 3aa058dcd5fb Applications/Samples/SimpleViewer/SimpleViewerApplication.cpp --- a/Applications/Samples/SimpleViewer/SimpleViewerApplication.cpp Mon Nov 12 15:52:03 2018 +0100 +++ b/Applications/Samples/SimpleViewer/SimpleViewerApplication.cpp Mon Nov 12 16:07:42 2018 +0100 @@ -104,7 +104,8 @@ { const Json::Value& response = message.GetJson(); - if (response.isArray() && response.size() > 1) + if (response.isArray() && + response.size() >= 1) { SelectStudy(response[0].asString()); } @@ -126,7 +127,9 @@ { const Json::Value& response = message.GetJson(); - if (response.isObject() && response["Instances"].isArray() && response["Instances"].size() > 0) + if (response.isObject() && + response["Instances"].isArray() && + response["Instances"].size() > 0) { // keep track of all instances IDs const std::string& seriesId = response["ID"].asString(); diff -r 6decc0ba9da5 -r 3aa058dcd5fb Applications/Samples/SimpleViewerApplicationSingleFile.h --- a/Applications/Samples/SimpleViewerApplicationSingleFile.h Mon Nov 12 15:52:03 2018 +0100 +++ b/Applications/Samples/SimpleViewerApplicationSingleFile.h Mon Nov 12 16:07:42 2018 +0100 @@ -338,11 +338,13 @@ { const Json::Value& response = message.GetJson(); - if (response.isArray() && response.size() > 1) + if (response.isArray() && + response.size() >= 1) { SelectStudy(response[0].asString()); } } + void OnStudyReceived(const OrthancApiClient::JsonResponseReadyMessage& message) { const Json::Value& response = message.GetJson(); @@ -402,6 +404,7 @@ void SelectStudy(const std::string& studyId) { + LOG(INFO) << "Selecting study: " << studyId; orthancApiClient_->GetJsonAsync("/studies/" + studyId, new Callable(*this, &SimpleViewerApplication::OnStudyReceived)); }