Make gesture recognizer failed when no previous or next view controller to pop or push