Merge pull request #10 from schungx/patch-1

Avoid exception when object.user is nil
This commit is contained in:
Régis Hanol 2017-12-07 15:23:38 +01:00 committed by GitHub
commit e77cf95a58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -49,8 +49,8 @@ after_initialize do
def excerpt
Post.excerpt(object.cooked, 70)
end
def username; object.user.username; end
def avatar_template; object.user.avatar_template; end
def username; object.user && object.user.username; end
def avatar_template; object.user && object.user.avatar_template; end
end
# Run a data explorer query on the currently connected database.