How to fix this race condition in Objective C / async problem? 'index 1 beyond bounds for empty array'

Refresh

2 weeks ago

Views

3 time

0

Hi i have a Problem with this Library: LTSupportAutomotive

I´m a swift programmer so not really good in objective c.

how to fix this race condition?

I hope someone can help me.

'*** -[__NSArrayM insertObject:atIndex:]: index 1 beyond bounds for empty array'

-(void)asyncEnqueueInternalCommand:(LTOBD2AdapterInternalCommand*)internalCommand
{
    @synchronized(self) {
        [_commandQueue addObject:internalCommand];
    }
}

Source code:

https://github.com/mickeyl/LTSupportAutomotive/blob/f51b962421f211ee6af5c733f79190117d7cac5e/LTSupportAutomotive/LTOBD2Adapter.m

0 answers