From b5857aaff7cbdc5382a398de58494b97b0616536 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Fri, 8 Nov 2013 11:21:06 +0000 Subject: catch empty features request --- rotord/src/rendercontext.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'rotord/src/rendercontext.cpp') diff --git a/rotord/src/rendercontext.cpp b/rotord/src/rendercontext.cpp index c3d8b93..2f07c89 100644 --- a/rotord/src/rendercontext.cpp +++ b/rotord/src/rendercontext.cpp @@ -420,14 +420,20 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H if (command.commands[1]=="features") { if (command.method=="GET") { if(state==IDLE){ - //parse json to get preview spec, return XML? this is a mess - string features_node=command.commands[2]; - if (graph.print_features(XML,features_node)) { - status=HTTPResponse::HTTP_OK; + if (command.commands.size()>2){ + //parse json to get preview spec, return XML? this is a mess + string features_node=command.commands[2]; + if (graph.print_features(XML,features_node)) { + status=HTTPResponse::HTTP_OK; + } + else { + status=HTTPResponse::HTTP_BAD_REQUEST; + logger.error("ERROR: Could not print features for node /"+features_node+"/"); + } } else { status=HTTPResponse::HTTP_BAD_REQUEST; - logger.error("ERROR: Could not print features for node /"+features_node+"/"); + logger.error("ERROR: Features node not specified"); } } else { -- cgit v1.2.3