From 92ec8d5b3ed04a6ba8c3c5a7ede268769a442806 Mon Sep 17 00:00:00 2001 From: Rufus Pollock Date: Sat, 21 Apr 2012 22:48:33 +0100 Subject: [PATCH] [backend/memory,bugfix][xs]: fix error on memory filtering when field value is null (cannot call toString). --- src/backend/memory.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backend/memory.js b/src/backend/memory.js index f79991e8..adf06bab 100644 --- a/src/backend/memory.js +++ b/src/backend/memory.js @@ -158,7 +158,8 @@ this.recline.Backend = this.recline.Backend || {}; _.each(terms, function(term) { var foundmatch = false; dataset.fields.each(function(field) { - var value = rawdoc[field.id].toString(); + var value = rawdoc[field.id]; + if (value !== null) { value = value.toString(); } // TODO regexes? foundmatch = foundmatch || (value === term); // TODO: early out (once we are true should break to spare unnecessary testing)