Fix null safety and performance in overview dialogs search (#1272)

* Initial plan

* fix: add optional chaining and optimize performance in overview dialogs

Co-authored-by: Azgaar <26469650+Azgaar@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Azgaar <26469650+Azgaar@users.noreply.github.com>
This commit is contained in:
Copilot 2026-01-22 13:05:54 +01:00 committed by GitHub
parent 330d098b0c
commit 03b84354ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 4 deletions

View file

@ -75,10 +75,10 @@ function overviewBurgs(settings = {stateId: null, cultureId: null}) {
// filter by search text
filtered = filtered.filter(b => {
const name = b.name.toLowerCase();
const state = (pack.states[b.state].name || "").toLowerCase();
const state = (pack.states[b.state]?.name || "").toLowerCase();
const prov = pack.cells.province[b.cell];
const province = prov ? pack.provinces[prov]?.name.toLowerCase() : "";
const culture = (pack.cultures[b.culture].name || "").toLowerCase();
const culture = (pack.cultures[b.culture]?.name || "").toLowerCase();
return (
name.includes(searchText) ||
state.includes(searchText) ||