From b9dcf0ac6355015b4d08a28049a7a8ddc361bb26 Mon Sep 17 00:00:00 2001 From: Logan Fick Date: Tue, 31 Oct 2017 21:59:01 -0400 Subject: Fixed user profile page returning internal server error if JSON file is missing. --- app/controllers/users_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d657053..a6a625d 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -32,7 +32,11 @@ class UsersController < ApplicationController end def show - @ban_json = JSON.parse(File.read("/etc/minecraft/redstoner/banned-players.json")).detect {|u| u["uuid"].tr("-", "") == @user.uuid} + begin + @ban_json = JSON.parse(File.read("/etc/minecraft/redstoner/banned-players.json")).detect {|u| u["uuid"].tr("-", "") == @user.uuid} + rescue + flash.now[:alert] = "An error occured while checking if this user is banned from the server!" + @ban_json = nil end # SIGNUP -- cgit v1.2.3