From 4f5c2c200ec4a001031aaec17575b46cda3896db Mon Sep 17 00:00:00 2001 From: Long Nguyen Date: Tue, 20 Jan 2015 00:26:46 -0800 Subject: [PATCH] Call removeFromParentViewController after removeFromSuperview in setCenterViewController to avoid EXC_BAD_ACCESS due to nil view value --- MMDrawerController/MMDrawerController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MMDrawerController/MMDrawerController.m b/MMDrawerController/MMDrawerController.m index 5e5df82f..121860a9 100644 --- a/MMDrawerController/MMDrawerController.m +++ b/MMDrawerController/MMDrawerController.m @@ -409,11 +409,11 @@ -(void)setCenterViewController:(UIViewController *)centerViewController animated if(animated == NO){ [oldCenterViewController beginAppearanceTransition:NO animated:NO]; } - [oldCenterViewController removeFromParentViewController]; [oldCenterViewController.view removeFromSuperview]; if(animated == NO){ [oldCenterViewController endAppearanceTransition]; } + [oldCenterViewController removeFromParentViewController]; } _centerViewController = centerViewController;