Fix null element on GridRep
This commit is contained in:
parent
406b3c1b44
commit
d1ec67d021
1 changed files with 6 additions and 2 deletions
|
|
@ -81,8 +81,12 @@ const GridRep = (props: Props) => {
|
|||
let url = ''
|
||||
|
||||
if (mainhand) {
|
||||
if (mainhand.element == 0 && props.grid[0] && props.grid[0].element) {
|
||||
url = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-main/${mainhand.granblue_id}_${props.grid[0].element}.jpg`
|
||||
const weapon = Object.values(props.grid).find(
|
||||
(w) => w && w.object.id === mainhand.id
|
||||
)
|
||||
|
||||
if (mainhand.element == 0 && weapon && weapon.element) {
|
||||
url = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-main/${mainhand.granblue_id}_${weapon.element}.jpg`
|
||||
} else {
|
||||
url = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-main/${mainhand.granblue_id}.jpg`
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue