From a3a9111cd8f4193d9a268cc4da469a5c6b721c7b Mon Sep 17 00:00:00 2001 From: Alexander Olofsson <alexander.olofsson@liu.se> Date: Thu, 5 Dec 2019 10:17:46 +0100 Subject: [PATCH] Fix possible type error from hash/array misuse --- lib/passwordstate/client.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/passwordstate/client.rb b/lib/passwordstate/client.rb index ef808e7..1153aae 100644 --- a/lib/passwordstate/client.rb +++ b/lib/passwordstate/client.rb @@ -105,8 +105,9 @@ module Passwordstate return data if res_obj.is_a? Net::HTTPSuccess data = data&.first + data = data.fetch('errors', []) if data.is_a? Hash - raise Passwordstate::HTTPError.new_by_code(res_obj.code, req_obj, res_obj, data&.fetch('errors', []) || []) + raise Passwordstate::HTTPError.new_by_code(res_obj.code, req_obj, res_obj, data || []) else return res_obj.body if res_obj.is_a?(Net::HTTPSuccess) && options.fetch(:allow_html, true) -- GitLab