Skip to content

Commit

Permalink
Fix reading unit names from unit short info
Browse files Browse the repository at this point in the history
The code wasn't stopping at the first 0 and eventually creating garbage
characters.
  • Loading branch information
lmoureaux authored and jwrober committed Jan 29, 2023
1 parent 1cc6218 commit 4034275
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client/packhand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@ unpackage_short_unit(const struct packet_unit_short_info *packet)
punit->veteran = packet->veteran;
punit->hp = packet->hp;
punit->activity = static_cast<unit_activity>(packet->activity);
punit->name = QString::fromUtf8(packet->name, ARRAY_SIZE(packet->name));
punit->name =
QString::fromUtf8(QByteArray(packet->name, ARRAY_SIZE(packet->name)));

if (packet->activity_tgt == EXTRA_NONE) {
punit->activity_target = nullptr;
Expand Down

0 comments on commit 4034275

Please sign in to comment.