Fixed nil pointer dereference caught by XCode Analyze