Skip to content

Commit df82d25

Browse files
francisbouvierkrichprollsch
authored andcommitted
Return error if a Page already exists in Session
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
1 parent bcf4083 commit df82d25

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/browser/browser.zig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ pub const Page = struct {
132132
fn init(
133133
alloc: std.mem.Allocator,
134134
session: *Session,
135-
) Page {
135+
) !Page {
136+
if (session.page != null) return error.SessionPageExists;
136137
var page = Page{
137138
.arena = std.heap.ArenaAllocator.init(alloc),
138139
.session = session,

0 commit comments

Comments
 (0)