简体   繁体   中英

Receiving Thread 1 error related to IF statement

I understand this is a common error but I can't figure out why I am receiving it: Thread 1 EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) :

在此处输入图片说明

Is there something specifically wrong with my code? To give some context the code is trying to determine if a particular item is on special and if it is then it strikes out the item's previous price that is displayed in the view controller.

You need to make sure globalVariable.previous and globalVariable.specialBool have the same count. Otherwise, the access to globalVariable.specialBool will crash.

Additionally, while i <= xxxx probably needs to be changed to while i < xxxx because array index is zero based.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM