Skip to content

Commit 3d7238b

Browse files
committed
Fixed get with undefined objectId
1 parent 6e2c4f9 commit 3d7238b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/query.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,17 @@
184184
* @param {Object} options A Backbone-style options object.
185185
*/
186186
get: function(objectId, options) {
187+
if(!objectId) {
188+
var errorObject = new AV.Error(AV.Error.OBJECT_NOT_FOUND,
189+
"Object not found.");
190+
return AV.Promise.error(errorObject);
191+
}
192+
187193
var self = this;
188194
self.equalTo('objectId', objectId);
189195

190196
return self.first().then(function(response) {
191-
if (response) {
197+
if (!AV._.isEmpty(response)) {
192198
return response;
193199
}
194200

0 commit comments

Comments
 (0)