diff --git a/src/js_results.cpp b/src/js_results.cpp index 8f154b8c..aca93769 100644 --- a/src/js_results.cpp +++ b/src/js_results.cpp @@ -160,7 +160,7 @@ JSObjectRef RJSResultsCreate(JSContextRef ctx, SharedRealm realm, std::string cl JSObjectRef RJSResultsCreate(JSContextRef ctx, realm::SharedRealm realm, const realm::ObjectSchema &objectSchema, realm::Query query, size_t argumentCount, const JSValueRef arguments[]) { std::string queryString = RJSValidatedStringForValue(ctx, arguments[0], "predicate"); - std::vector args( argumentCount - 1 ); + std::vector args(argumentCount - 1); for (size_t i = 1; i < argumentCount; i++) { args[i-1] = arguments[i]; } diff --git a/tests/lib/results-tests.js b/tests/lib/results-tests.js index 9431fcfd..dd71f71a 100644 --- a/tests/lib/results-tests.js +++ b/tests/lib/results-tests.js @@ -130,6 +130,10 @@ module.exports = BaseTest.extend({ TestCase.assertEqual(realm.objects('DefaultValuesObject').filtered('dateCol > $0', new Date(4)).length, 1); TestCase.assertEqual(realm.objects('DefaultValuesObject').filtered('dateCol <= $0', new Date(4)).length, 2); + + TestCase.assertThrows(function() { + realm.objects('PersonObject').filtered("invalidQuery"); + }); }, testSort: function() { var realm = new Realm({schema: [schemas.TestObject]});