Skip to content

Commit 32c43ca

Browse files
author
Kapil Ratnani
committed
added check for empty string, writes an error message for the same
1 parent 0d63816 commit 32c43ca

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

NppJSONViewer/JSONDialog.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,13 @@ void JSONDialog::drawTree()
186186

187187
tree_root=initTree(this->getHSelf());
188188

189+
if(strlen(curJSON)==0){
190+
insertToTree(this->getHSelf(),tree_root,"Error:Please select a JSON String.");
191+
TreeView_Expand(GetDlgItem(this->getHSelf(),IDC_TREE1),tree_root,TVE_EXPAND);
192+
return;
193+
}
194+
195+
189196
jpi = (json_parsing_info*)malloc (sizeof (struct json_parsing_info));
190197
if (jpi == NULL)
191198
{

0 commit comments

Comments
 (0)