fix: crash on palette init error

This commit is contained in:
CJ van den Berg 2026-04-09 19:50:18 +02:00
parent 2e0e8fd527
commit 908f2f57fb
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 2 additions and 0 deletions

View file

@ -93,6 +93,7 @@ pub fn Create(options: type) type {
.match_count = 0,
};
try self.commands.init(self);
errdefer self.commands.deinit();
self.mode.event_handler = EventHandler.to_owned(self);
self.mode.name = options.name;
if (self.menu.scrollbar) |scrollbar| scrollbar.style_factory = scrollbar_style;

View file

@ -113,6 +113,7 @@ pub fn Create(options: type) type {
.placement = if (@hasDecl(options, "placement")) options.placement else .top_center,
};
try self.commands.init(self);
errdefer self.commands.deinit();
self.mode.event_handler = EventHandler.to_owned(self);
self.mode.name = options.name;
if (self.menu.scrollbar) |scrollbar| scrollbar.style_factory = scrollbar_style;