fix: panic rendering corrupted data
2 files changed, 38 insertions(+), 2 deletions(-)
M internal/components/options.go → internal/components/options.go
@@ -26,8 +26,25 @@ if m := convertMatch[nix.Option](hit.Data); m != nil { return optionRow(hit, *m) } - return nil + return emptyOptionRow(hit) }), + ), + ) +} + +func emptyOptionRow(hit index.DocumentMatch) g.Node { + return Tr( + Td( + g.Text(hit.ID), + ), + Td(Class("description"), + g.Text("No description available"), + Dialog(ID(hit.ID)), + ), + g.If(config.DevMode, + Td(Class("score"), + Score(hit), + ), ), ) }
M internal/components/packages.go → internal/components/packages.go
@@ -27,8 +27,27 @@ if m := convertMatch[nix.Package](hit.Data); m != nil { return packageRow(hit, *m) } - return nil + return emptyPackageRow(hit) }), + ), + ) +} + +func emptyPackageRow(hit index.DocumentMatch) g.Node { + return Tr( + Td( + openDialogLink(hit.ID), + ), + Td( + g.Text(hit.ID), + ), + Td(Class("description"), + g.Text("No description available"), + ), + g.If(config.DevMode, + Td(Class("score"), + Score(hit), + ), ), ) }