diff options
author | Logan Fick <logaldeveloper@protonmail.com> | 2017-10-31 21:59:01 -0400 |
---|---|---|
committer | Logan Fick <logaldeveloper@protonmail.com> | 2017-10-31 21:59:01 -0400 |
commit | b9dcf0ac6355015b4d08a28049a7a8ddc361bb26 (patch) | |
tree | 9c0b750f5852a6ebda75be116d8d93f06f767d50 | |
parent | 3fb5924318dee8f023dbea5e31526a74ca1f35e8 (diff) |
Fixed user profile page returning internal server error if JSON file is missing.
-rw-r--r-- | app/controllers/users_controller.rb | 6 |
1 files changed, 5 insertions, 1 deletions
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 |