Skip to content

Commit

Permalink
Removed "Error at line 0" in errors before the first line is read.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lexikos committed May 3, 2021
1 parent f0acb8a commit f822897
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions source/script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16701,8 +16701,11 @@ ResultType Script::ScriptError(LPCTSTR aErrorText, LPCTSTR aExtraInfo) //, Resul
TCHAR buf[MSGBOX_TEXT_SIZE], *cp = buf;
int buf_space_remaining = (int)_countof(buf);

cp += sntprintf(cp, buf_space_remaining, _T("Error at line %u"), mCombinedLineNumber); // Don't call it "critical" because it's usually a syntax error.
buf_space_remaining = (int)(_countof(buf) - (cp - buf));
if (mCombinedLineNumber || mCurrFileIndex)
{
cp += sntprintf(cp, buf_space_remaining, _T("Error at line %u"), mCombinedLineNumber); // Don't call it "critical" because it's usually a syntax error.
buf_space_remaining = (int)(_countof(buf) - (cp - buf));
}

if (mCurrFileIndex)
{
Expand All @@ -16711,8 +16714,11 @@ ResultType Script::ScriptError(LPCTSTR aErrorText, LPCTSTR aExtraInfo) //, Resul
}
//else don't bother cluttering the display if it's the main script file.

cp += sntprintf(cp, buf_space_remaining, _T(".\n\n"));
buf_space_remaining = (int)(_countof(buf) - (cp - buf));
if (mCombinedLineNumber || mCurrFileIndex)
{
cp += sntprintf(cp, buf_space_remaining, _T(".\n\n"));
buf_space_remaining = (int)(_countof(buf) - (cp - buf));
}

if (*aExtraInfo)
{
Expand Down

0 comments on commit f822897

Please sign in to comment.