From 2461d18c2955b4be5bfffecb4b6d52124b8846b8 Mon Sep 17 00:00:00 2001
From: Roman Salabay <rsalabaha@gmail.com>
Date: Thu, 4 Jan 2018 13:00:21 +0200
Subject: [PATCH] Addressed issue when st_presentViewController tried to
 present viewControllerToPresent which is nil

---
 STPopup/UIViewController+STPopup.m | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/STPopup/UIViewController+STPopup.m b/STPopup/UIViewController+STPopup.m
index b80a977..408e26a 100644
--- a/STPopup/UIViewController+STPopup.m
+++ b/STPopup/UIViewController+STPopup.m
@@ -64,7 +64,9 @@ - (void)st_viewDidLoad
 - (void)st_presentViewController:(UIViewController *)viewControllerToPresent animated:(BOOL)flag completion:(void (^)(void))completion
 {
     if (!self.popupController) {
-        [self st_presentViewController:viewControllerToPresent animated:flag completion:completion];
+        if (viewControllerToPresent != nil) {
+            [self st_presentViewController:viewControllerToPresent animated:flag completion:completion];
+        }
         return;
     }
     
@@ -157,4 +159,4 @@ - (STPopupController *)popupController
     return popupController;
 }
 
-@end
\ No newline at end of file
+@end