From e789d5350b31fd65267d7f740ba705053073c422 Mon Sep 17 00:00:00 2001 From: Trevor Rosen Date: Thu, 17 Jul 2014 10:15:22 -0500 Subject: [PATCH] No idea why this didn't fail before MSP-10724 --- lib/msf/core/db.rb | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/lib/msf/core/db.rb b/lib/msf/core/db.rb index 75a7018cf3..0d7d31a440 100644 --- a/lib/msf/core/db.rb +++ b/lib/msf/core/db.rb @@ -1372,8 +1372,6 @@ class DBManager =end ntype = opts.delete(:type) || opts.delete(:ntype) || (raise RuntimeError, "A note :type or :ntype is required") data = opts[:data] - method = nil - args = [] note = nil conditions = { :ntype => ntype } @@ -1382,15 +1380,7 @@ class DBManager case mode when :unique - notes = wspace.notes.where(conditions) - - # Only one note of this type should exist, make a new one if it - # isn't there. If it is, grab it and overwrite its data. - if notes.empty? - note = wspace.notes.new(conditions) - else - note = notes[0] - end + note = wspace.notes.where(conditions).first_or_initialize note.data = data when :unique_data notes = wspace.notes.where(conditions)