Return error if a Page already exists in Session

Signed-off-by: Francis Bouvier <francis@lightpanda.io>
This commit is contained in:
Francis Bouvier
2024-04-19 13:11:04 +02:00
committed by Pierre Tachoire
parent bcf4083f9c
commit df82d25e91

View File

@@ -132,7 +132,8 @@ pub const Page = struct {
fn init( fn init(
alloc: std.mem.Allocator, alloc: std.mem.Allocator,
session: *Session, session: *Session,
) Page { ) !Page {
if (session.page != null) return error.SessionPageExists;
var page = Page{ var page = Page{
.arena = std.heap.ArenaAllocator.init(alloc), .arena = std.heap.ArenaAllocator.init(alloc),
.session = session, .session = session,