About Store Forum Documentation Contact



Post Reply 
File.get crash
Author Message
Lancer Offline
Member

Post: #1
File.get crash
Issue: When having a struct with "Str" variable, then the app crashes when using File.get().

Example:
struct STRUCT_NAME
{
UInt a;
Str b;
Byte c;
Byte d;
};

App1:
STRUCT_NAME temp[4];
temp[0].a = 1;
temp[0].b = "Tester";
temp[0].c = 0;
temp[0].d = 0;

res.writeMem().putShort(5000)
.putUShort(0).putUInt(1).putByte(1);

res.put(temp[0]);
res.pos(0);
connection.send(res, -1, false);

App2:
.. code to get packet ..
Short opcode = data.getShort();
UShort ushort1 = data.getUShort();
UInt uint1 = data.getUInt();
Byte byte1 = data.getByte();
STRUCT_NAME temp[4];
data.get(temp[0]);

Info:
We send a packet with struct STRUCT_NAME from App1 to App2.
After data.get(temp), it will crash. Tried everything possible already.
Screenshot of crash
   

Without the "Str" variable, everything works fine.

Edit: It also works fine if the Str variable is empty. But once I set the Str variable to something like "Tester", then it crashes.

System: Windows 10 64 bit
(This post was last modified: 06-27-2019 07:34 PM by Lancer.)
06-27-2019 07:29 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: File.get crash
You can't do that. You have to save class members separately.
Make a Bool save(File &f) class method.
06-28-2019 05:10 AM
Find all posts by this user Quote this message in a reply
Lancer Offline
Member

Post: #3
RE: File.get crash
Oh thanks.
Now it's working fine.

Btw. Whenever I press on "Quote", I'm getting the issue
"This page isn’t working http://www.esenthel.com is currently unable to handle this request.
HTTP ERROR 500"
06-28-2019 05:58 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: File.get crash
Thank you very much, I've fixed it.
06-29-2019 01:11 AM
Find all posts by this user Quote this message in a reply
Post Reply