forked from Wirlaburla/P3NG0
lookUpWorldName() halts immediately after logging world discovery (main.cpp line 816) #1
Labels
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: bonkmaykr/Tourbot#1
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The bot quits in the middle of lookUpWorldName() and then returns to idling, as soon as it reaches line 817 where it tries to create a new position struct to hold the JSON values in. It's believed this is an internal issue with the bot trying to read the data from the iterator *key.
Narrowed it down to this line causing the issue:
details.position.x = (*key)["position"][0];
all 3 lines after which set the other axis y and z and rotation are affected.
One thing I can't believe I didn't see before: the contents of the array inside of the JSON are stored as STRINGS and not integers:
Simply changing the values to integers fixes the bug. Tourbot was attempting to store a string into an integer within markEntry.position.x, there was no error handler in place and the compiler did not catch this as there was no way it could have foreseen this would happen since the input that caused it was outside the program (and the return value from json["key"] can be any type).
This probably does not need further fixing, however, adding error handling to detect when this happens and cast the string to an integer for the administrator's sake, a fairly easy thing to do, should be added to the todo list.