Solved Unexpected radio command can break the damagelogs.

Status
Not open for further replies.

iii

Member
Legacy
Short description:
Running specific radio commands can cause a bug that breaks the damagelogs, rendering you unable to see* the logs of that round after the radio command was executed (i.e. if it's at the start of the round, then you can't see the entire logs for that round).

*Although presumably the logs are still there, they just aren't displayed because of the error.


Steps to reproduce:
- Play during a round
- Use this console command: _ttt_radio_send quick_imwith 39
- Verify that the message sent was "I'm with .", otherwise try a higher number
- Look at the damagelog for that round


Text of the error:
[ttt damagelogs] addons/ttt damagelogs/lua/damagelogs/damagelog_events/ttt_radio.lua:51: bad argument #1 to 'GetNameParam' (string expected, got nil)
1. GetNameParam - [C]:-1
2. ToString - addons/ttt damagelogs/lua/damagelogs/damagelog_events/ttt_radio.lua:51
3. AddLogsLine - addons/ttt damagelogs/lua/damagelogs/cl_listview.lua:96
4. SetListViewTable - addons/ttt damagelogs/lua/damagelogs/cl_listview.lua:126
5. FinishedLoading - addons/ttt damagelogs/lua/damagelogs/cl_tabs/damagetab.lua:381
6. ReceiveLogs - addons/ttt damagelogs/lua/damagelogs/cl_tabs/damagetab.lua:364
7. func - addons/ttt damagelogs/lua/damagelogs/cl_tabs/damagetab.lua:375
8. unknown - lua/includes/extensions/net.lua:32


Command explanation:
When you use the radio (like with the command ttt_radio imwith) it internally calls this command: _ttt_radio_send quick_imwith number_or_text_representing_what_you_last_aimed_at.

Meaning if you use the command _ttt_radio_send quick_imwith 1 it will say in radio chat "I'm with name_of_player_with_id_1.".

If you use that command with a number isn't the id of a connected player nor the id of a body (like 39, since the server only ever has a max of 38 players) it will say "I'm with ." (this I knew beforehand), but it ALSO seems to cause a lua error when the damage logs for that round tries to display that line (this I didn't know), which makes you unable to see the rest of the logs after that message.


Solution suggestions:
1. Perhaps you can edit the GetNameParam function or the code before it so that that it checks if the value is nil and handles it in a way that doesn't cause a lua error.
2. Or alternatively alter the _ttt_radio_send command so that you can't use it on ids that aren't players or bodies, although this has the drawback that it makes it harder to update TTT if a new version comes out.
 
Last edited:

My Dime Is Up

My Dime Is Kachow
Developer
Moderator
VIP
Legacy
I've gone ahead and fixed this. You are correct the logs do exist in data but wouldn't show due to the variable being nil and would halt reading the rest of the code. Any damagelogs which couldn't be loaded before can be loaded now
 
Status
Not open for further replies.
Top