File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Shared/mods/deathmatch/logic/luadefs Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -732,7 +732,7 @@ int CLuaFileDefs::fileWrite(lua_State* luaVM)
732732 CScriptArgReader argStream (luaVM);
733733 argStream.ReadUserData (pFile);
734734
735- // Ensure we have atleast one string
735+ // Ensure we have at least one string
736736 if (!argStream.NextIsString ())
737737 argStream.SetTypeError (" string" );
738738
@@ -745,12 +745,14 @@ int CLuaFileDefs::fileWrite(lua_State* luaVM)
745745 while (argStream.NextIsString ())
746746 {
747747 // Grab argument and length
748- SString strData;
749- argStream.ReadString (strData);
750- unsigned long ulDataLen = strData.length ();
748+ SCharStringRef strData;
749+ argStream.ReadCharStringRef (strData);
750+
751+ if (argStream.HasErrors () || !strData.pData )
752+ continue ;
751753
752754 // Write the data
753- long lArgBytesWritten = pFile->Write (ulDataLen , strData);
755+ long lArgBytesWritten = pFile->Write (strData. uiSize , strData. pData );
754756
755757 // Did the file mysteriously disappear?
756758 if (lArgBytesWritten == -1 )
You can’t perform that action at this time.
0 commit comments