From d9cb20ef98d9b9e3d17e4bb8c87236d79d8f3c84 Mon Sep 17 00:00:00 2001 From: Kyle Matthew Hedden Date: Wed, 14 Oct 2020 11:57:29 -0400 Subject: [PATCH] test to make sure we are looking at an MVMCoreNavigationOperation before casting. --- .../PresentationHandling/MVMCoreNavigationHandler.m | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationHandler.m b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationHandler.m index 7e9bb82..a88076e 100644 --- a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationHandler.m +++ b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationHandler.m @@ -266,15 +266,11 @@ - (nullable NSArray *)getViewControllersForNavigationController:(nullable UINavigationController *)navigationController { // Check if we are currently animating. NSInteger index = [self.navigationQueue.operations indexOfObjectPassingTest:^BOOL(__kindof MVMCoreNavigationOperation * _Nonnull operation, NSUInteger idx, BOOL * _Nonnull stop) { - if (operation.isExecuting) { - *stop = YES; - return YES; - } else { - return NO; - } + return operation.isExecuting && [operation isKindOfClass:[MVMCoreNavigationOperation class]]; }]; if (index != NSNotFound) { + // Test above ensures we have an MVMCoreNavigationOperation. There are situations where block operations are submitted to the queue to be executed. MVMCoreNavigationOperation *operation = [self.navigationQueue.operations objectAtIndex:index]; if (operation.navigationObject.navigationController == navigationController && operation.futureViewControllers) { // Return the future state if animating.