diff --git a/NppJSONViewer/NppJsonViewer/JsonViewDlg.cpp b/NppJSONViewer/NppJsonViewer/JsonViewDlg.cpp index bb515a7..3ad0b9f 100644 --- a/NppJSONViewer/NppJsonViewer/JsonViewDlg.cpp +++ b/NppJSONViewer/NppJsonViewer/JsonViewDlg.cpp @@ -181,8 +181,10 @@ void JsonViewDlg::PopulateTreeUsingSax(HTREEITEM tree_root, const std::string &j ShowMessage(JSON_ERROR_TITLE, (JSON_ERR_VALIDATE + StringHelper::ToWstring(err)).c_str(), MB_OK | MB_ICONERROR); } } - - m_Editor->SetLangAsJson(); + else + { + m_Editor->SetLangAsJson(); + } } HTREEITEM JsonViewDlg::InsertToTree(HTREEITEM parent, const std::string &text) diff --git a/NppJSONViewer/NppJsonViewer/ScintillaEditor.cpp b/NppJSONViewer/NppJsonViewer/ScintillaEditor.cpp index 5cb312c..37e31da 100644 --- a/NppJSONViewer/NppJsonViewer/ScintillaEditor.cpp +++ b/NppJSONViewer/NppJsonViewer/ScintillaEditor.cpp @@ -39,7 +39,7 @@ std::string ScintillaEditor::GetJsonText() void ScintillaEditor::SetLangAsJson() const { - ::SendMessage(m_hScintilla, NPPM_SETCURRENTLANGTYPE, 0, LangType::L_JSON); + ::SendMessage(m_NppData._nppHandle, NPPM_SETCURRENTLANGTYPE, 0, LangType::L_JSON); } bool ScintillaEditor::IsJsonFile() const