fix: use zero for values when no fit is selected (#132)

This commit is contained in:
Patric Stout
2024-05-25 12:34:16 +02:00
committed by GitHub
parent b7252fa593
commit ef1e740567

View File

@@ -23,14 +23,17 @@ export function useAttribute(type: "Ship" | "Char", props: AttributeProps) {
const eveData = useEveData();
const statistics = useStatistics();
if (eveData === null || statistics === null) return "";
const attributeId = eveData.attributeMapping[props.name] ?? 0;
let value;
if (type === "Ship") {
value = statistics.hull.attributes.get(attributeId)?.value;
if (eveData === null || statistics === null) {
value = 0;
} else {
value = statistics.char.attributes.get(attributeId)?.value;
const attributeId = eveData.attributeMapping[props.name] ?? 0;
if (type === "Ship") {
value = statistics.hull.attributes.get(attributeId)?.value;
} else {
value = statistics.char.attributes.get(attributeId)?.value;
}
}
if (value === undefined) {