diff options
| author | Marvin W <git@larma.de> | 2025-04-07 14:09:57 +0200 |
|---|---|---|
| committer | Marvin W <git@larma.de> | 2025-04-07 14:11:05 +0200 |
| commit | 7dc815ac4d196f01ce76fc5e61ef13b02dace15e (patch) | |
| tree | b3686ce21c11288d350782c6fbb80924c4ce194e /xmpp-vala/src | |
| parent | db1830c54ecc70f7933febab02c2ad7ee44d0bd1 (diff) | |
Fix unexpected behavior of get_attribute_uint on systems with 32-bit long
Diffstat (limited to 'xmpp-vala/src')
| -rw-r--r-- | xmpp-vala/src/core/stanza_node.vala | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/xmpp-vala/src/core/stanza_node.vala b/xmpp-vala/src/core/stanza_node.vala index 54c14956..6911b4b2 100644 --- a/xmpp-vala/src/core/stanza_node.vala +++ b/xmpp-vala/src/core/stanza_node.vala @@ -102,7 +102,7 @@ public class StanzaNode : StanzaEntry { if (attribute_str == null) return def; int res = def; - bool parse_success = int.try_parse(attribute_str, out res); + bool parse_success = int.try_parse(attribute_str, out res, null, 10); if (!parse_success) { info("Could not parse int attribute %s: %s", name, attribute_str); return def; @@ -112,10 +112,10 @@ public class StanzaNode : StanzaEntry { public uint get_attribute_uint(string name, uint def = 0, string? ns_uri = null) { string? attribute_str = get_attribute(name, ns_uri); - if (attribute_str == null) return def; + if (attribute_str == null || attribute_str.strip().has_prefix("-")) return def; uint res = def; - bool parse_success = uint.try_parse(attribute_str, out res); + bool parse_success = uint.try_parse(attribute_str, out res, null, 10); if (!parse_success) { info("Could not parse uint attribute %s: %s", name, attribute_str); return def; |
