From c39b66bce251bb4a71adc5d8401d74c91c904ec2 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sat, 19 Nov 2022 18:49:21 -0800 Subject: [PATCH] Try to fix object error --- components/CharacterGrid/index.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/CharacterGrid/index.tsx b/components/CharacterGrid/index.tsx index 65697d5a..dab368da 100644 --- a/components/CharacterGrid/index.tsx +++ b/components/CharacterGrid/index.tsx @@ -231,7 +231,9 @@ const CharacterGrid = (props: Props) => { ) const updateUncapLevel = (position: number, uncapLevel: number) => { - appState.grid.characters[position].uncap_level = uncapLevel + if (grid.characters[position]) { + appState.grid.characters[position]!.uncap_level = uncapLevel + } } function storePreviousUncapValue(position: number) { @@ -239,7 +241,8 @@ const CharacterGrid = (props: Props) => { let newPreviousValues = { ...previousUncapValues } if (grid.characters[position]) { - newPreviousValues[position] = grid.characters[position].uncap_level + const character = grid.characters[position] + newPreviousValues[position] = character ? character.uncap_level : -1 setPreviousUncapValues(newPreviousValues) } }