FIX: handle nil topic value when removing allowed users

This commit is contained in:
Arpit Jalan 2018-11-20 22:54:39 +05:30
parent 92100f82eb
commit 5951e111ad
1 changed files with 1 additions and 1 deletions

View File

@ -503,7 +503,7 @@ class TopicsController < ApplicationController
user = User.find_by(username: params[:username])
guardian.ensure_can_remove_allowed_users!(topic, user)
if topic.remove_allowed_user(current_user, user)
if topic&.remove_allowed_user(current_user, user)
render json: success_json
else
render json: failed_json, status: 422