Skip to content

Commit 2af803f

Browse files
committed
null check first in r.expr()
1 parent 2a474fb commit 2af803f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/term.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2165,7 +2165,10 @@ Term.prototype.expr = function(expression, nestingLevel) {
21652165
//if (nestingLevel == null) nestingLevel = self._r.nestingLevel;
21662166
if (_nestingLevel < 0) throw new Error.ReqlDriverError('Nesting depth limit exceeded.\nYou probably have a circular reference somewhere')
21672167

2168-
if (expression instanceof Term || expression.__proxy) {
2168+
if (expression === null) {
2169+
return new Term(self._r, null, expression);
2170+
}
2171+
else if (expression instanceof Term || expression.__proxy) {
21692172
return expression;
21702173
}
21712174
else if (expression instanceof Function) {
@@ -2198,10 +2201,7 @@ Term.prototype.expr = function(expression, nestingLevel) {
21982201
return new Term(self._r, null, optArgs);
21992202
}
22002203
else { // Primitive
2201-
if (expression === null) {
2202-
return new Term(self._r, null, expression);
2203-
}
2204-
else if (typeof expression === 'string') {
2204+
if (typeof expression === 'string') {
22052205
// RethinkDB doesn't support the null character.
22062206
if (/\00/.test(expression)) {
22072207
self._error = new Error.ReqlDriverError('The null character is currently not supported by RethinkDB');

0 commit comments

Comments
 (0)