From ea2ae9c60824f5a56ddcbc01939b323f0adeec51 Mon Sep 17 00:00:00 2001
From: Alexander Olofsson <alexander.olofsson@liu.se>
Date: Fri, 25 Oct 2019 15:23:23 +0200
Subject: [PATCH] Avoid direct searches if no data is loaded

---
 lib/passwordstate/resource_list.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/passwordstate/resource_list.rb b/lib/passwordstate/resource_list.rb
index 255b2a4..2727b69 100644
--- a/lib/passwordstate/resource_list.rb
+++ b/lib/passwordstate/resource_list.rb
@@ -95,7 +95,7 @@ module Passwordstate
     def get(id, query = {})
       raise 'Operation not supported' unless operation_supported?(:get)
 
-      if query.empty?
+      if query.empty? && !entries.empty?
         existing = entries.find do |entry|
           entry.send(entry.class.index_field) == id
         end
-- 
GitLab