dom: an event type can be null

In this case we return empty string
This commit is contained in:
Pierre Tachoire
2024-04-29 16:31:37 +02:00
parent 2a94e5a69e
commit 9f2bad7498

View File

@@ -397,6 +397,10 @@ pub fn eventType(evt: *Event) ![]const u8 {
var s: ?*String = undefined;
const err = c._dom_event_get_type(evt, &s);
try DOMErr(err);
// if the event type is null, return a empty string.
if (s == null) return "";
return strToData(s.?);
}