mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-15 00:43:52 +00:00
fix: guard hexDecode std::stoul; extract duration formatting helpers
- Wrap std::stoul in auth_screen hexDecode() with try-catch to prevent crash on malformed saved password hex data - Add fmtDurationCompact() helper replacing 3 identical duration format blocks (hours/minutes/seconds for aura icon overlays) - Add renderAuraRemaining() helper replacing 5 identical "Remaining: Xm Ys" tooltip blocks across player/target/focus/raid aura tooltips
This commit is contained in:
parent
0ae7360255
commit
6783ead4ba
2 changed files with 31 additions and 49 deletions
|
|
@ -44,8 +44,12 @@ static std::string hexEncode(const std::vector<uint8_t>& data) {
|
|||
static std::vector<uint8_t> hexDecode(const std::string& hex) {
|
||||
std::vector<uint8_t> bytes;
|
||||
for (size_t i = 0; i + 1 < hex.size(); i += 2) {
|
||||
uint8_t b = static_cast<uint8_t>(std::stoul(hex.substr(i, 2), nullptr, 16));
|
||||
bytes.push_back(b);
|
||||
try {
|
||||
uint8_t b = static_cast<uint8_t>(std::stoul(hex.substr(i, 2), nullptr, 16));
|
||||
bytes.push_back(b);
|
||||
} catch (...) {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue