diff --git a/src/client/http/Request.cpp b/src/client/http/Request.cpp index c4f7e4679..e27291ef5 100644 --- a/src/client/http/Request.cpp +++ b/src/client/http/Request.cpp @@ -267,6 +267,7 @@ namespace http { std::istringstream ss(result); Json::Value root; + int status; try { ss >> root; @@ -275,11 +276,7 @@ namespace http { return; } - int status = root.get("Status", 1).asInt(); - if (status != 1) - { - throw RequestError(ByteString(root.get("Error", "Unspecified Error").asString())); - } + status = root.get("Status", 1).asInt(); } catch (const std::exception &ex) { @@ -291,6 +288,11 @@ namespace http } throw RequestError("Could not read response: " + ByteString(ex.what())); } + + if (status != 1) + { + throw RequestError(ByteString(root.get("Error", "Unspecified Error").asString())); + } } break; diff --git a/src/gui/preview/PreviewView.cpp b/src/gui/preview/PreviewView.cpp index 50ed635f0..66d237a34 100644 --- a/src/gui/preview/PreviewView.cpp +++ b/src/gui/preview/PreviewView.cpp @@ -427,6 +427,7 @@ void PreviewView::OnTick(float dt) { try { + addCommentRequest->Finish(); addCommentBox->SetText(""); c->CommentAdded(); } @@ -600,6 +601,11 @@ void PreviewView::submitComment() if (addCommentBox) { String comment = addCommentBox->GetText(); + if (comment.length() == 0) + { + c->CommentAdded(); + return; + } if (comment.length() < 4) { new ErrorMessage("Error", "Comment is too short");