summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2018-08-09 18:27:45 +0100
committerNick Thomas <nick@gitlab.com>2018-08-09 18:43:36 +0100
commitcce62b3571617e2df3aee8df4b3b1908191dc495 (patch)
tree4841aa4af4011e8e206c434f4717d2938c12e191
parent6e907f26475f16ad7d3e02aa64138e0fe35bb6b9 (diff)
downloadgitlab-shell-cce62b3571617e2df3aee8df4b3b1908191dc495.tar.gz
Guard discovery by username or key against bad API responses
-rw-r--r--lib/gitlab_shell.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/gitlab_shell.rb b/lib/gitlab_shell.rb
index c6b28ce..03edf65 100644
--- a/lib/gitlab_shell.rb
+++ b/lib/gitlab_shell.rb
@@ -208,7 +208,7 @@ class GitlabShell # rubocop:disable Metrics/ClassLength
begin
if defined?(@who)
@user = api.discover(@who)
- @gl_id = "user-#{@user['id']}" if @user
+ @gl_id = "user-#{@user['id']}" if @user && @user.key?('id')
else
@user = api.discover(@gl_id)
end