Skip to content

Commit b2960bc

Browse files
committed
Fixed #9111 (Everything in a string to the right of a colon will be cut off in error and assert)
1 parent 9309da0 commit b2960bc

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

MTA10/mods/shared_logic/CScriptDebugging.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,11 @@ void CScriptDebugging::LogPCallError( lua_State* luaVM, const SString& strRes, b
185185
// File+line info present
186186
SString strFile = vecSplit[ 0 ];
187187
int iLine = atoi( vecSplit[ 1 ] );
188-
SString strMsg = vecSplit[2].SubStr( 1 );
189-
188+
189+
// Get the message string (we cannot use vecSplit here as the message itself could contain ':')
190+
auto pos = strRes.find ( ':', vecSplit[0].length () + vecSplit[1].length () ) ;
191+
SString strMsg = strRes.SubStr ( pos+2 );
192+
190193
if ( iLine == 0 && bInitialCall )
191194
{
192195
// Location hint for compiled scripts

MTA10_Server/mods/deathmatch/logic/CScriptDebugging.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,10 @@ void CScriptDebugging::LogPCallError( lua_State* luaVM, const SString& strRes, b
214214
// File+line info present
215215
SString strFile = vecSplit[ 0 ];
216216
int iLine = atoi( vecSplit[ 1 ] );
217-
SString strMsg = vecSplit[2].SubStr( 1 );
217+
218+
// Get the message string (we cannot use vecSplit here as the message itself could contain ':')
219+
auto pos = strRes.find ( ':', vecSplit[0].length () + vecSplit[1].length () ) ;
220+
SString strMsg = strRes.SubStr ( pos+2 );
218221

219222
if ( iLine == 0 && bInitialCall )
220223
{

0 commit comments

Comments
 (0)