Skip to content

Commit b459f5a

Browse files
CFrankCFrank
authored andcommitted
put stoi in try catch block to avoid non integer conversion exception
1 parent cf0f849 commit b459f5a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

PythonScript/src/ConsoleDialog.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,15 @@ void ConsoleDialog::initDialog(HINSTANCE hInst, NppData& nppData, ConsoleInterfa
7575
{
7676
DockingDlgInterface::init(hInst, nppData._nppHandle);
7777

78-
m_user_color = stoi(ConfigFile::getInstance()->getSetting(_T("COLORIZEOUTPUT")));
79-
m_colorOutput = m_user_color > -1;
78+
try
79+
{
80+
m_user_color = stoi(ConfigFile::getInstance()->getSetting(_T("COLORIZEOUTPUT")));
81+
m_colorOutput = m_user_color > -1;
82+
}
83+
catch (const std::exception&)
84+
{
85+
m_colorOutput = false;
86+
}
8087
m_prompt = ConfigFile::getInstance()->getSetting(_T("ADDEXTRALINETOOUTPUT")) == _T("1") ? m_prompt.insert(0, "\n") : m_prompt;
8188

8289
//Window::init(hInst, nppData._nppHandle);

0 commit comments

Comments
 (0)