Skip to content

Commit f901f90

Browse files
committed
fix(webui): improve getContext null handling
- use Zig optional binding to check for null context - ensure consistent error return when context is missing
1 parent 1b81ccc commit f901f90

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/webui.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,7 +1226,7 @@ pub const Event = extern struct {
12261226
/// Get user data that is set using `SetContext()`.
12271227
pub fn getContext(e: *Event) !*anyopaque {
12281228
const context = c.webui_get_context(e);
1229-
if (context == null) return WebUIError.GenericError;
1230-
return context;
1229+
if (context) |result| return result;
1230+
return WebUIError.GenericError;
12311231
}
12321232
};

0 commit comments

Comments
 (0)