@@ -392,6 +392,10 @@ class _NitriteDocument extends Document {
392
392
}
393
393
394
394
var key = splits[0 ];
395
+ if (key.isNullOrEmpty) {
396
+ throw ValidationException ("Invalid key provided" );
397
+ }
398
+
395
399
if (splits.length == 1 ) {
396
400
// if last key, simply remove from the current document
397
401
remove (key);
@@ -448,8 +452,13 @@ class _NitriteDocument extends Document {
448
452
return null ;
449
453
}
450
454
455
+ var key = path[0 ];
456
+ if (key.isNullOrEmpty) {
457
+ throw ValidationException ("Invalid key provided" );
458
+ }
459
+
451
460
// get current level value and scan to next level using remaining keys
452
- return _recursiveGet (this [path[ 0 ] ], path.sublist (1 ));
461
+ return _recursiveGet (this [key ], path.sublist (1 ));
453
462
}
454
463
455
464
dynamic _recursiveGet (dynamic value, List <String > splits) {
@@ -463,6 +472,11 @@ class _NitriteDocument extends Document {
463
472
464
473
if (value is _NitriteDocument ) {
465
474
// if the current level value is document, scan to the next level with remaining keys
475
+ var key = splits[0 ];
476
+ if (key.isNullOrEmpty) {
477
+ throw ValidationException ("Invalid key provided" );
478
+ }
479
+
466
480
return _recursiveGet (value[splits[0 ]], splits.sublist (1 ));
467
481
}
468
482
@@ -471,6 +485,10 @@ class _NitriteDocument extends Document {
471
485
472
486
// get the first key
473
487
var key = splits[0 ];
488
+ if (key.isNullOrEmpty) {
489
+ throw ValidationException ("Invalid key provided" );
490
+ }
491
+
474
492
if (_isInteger (key)) {
475
493
// if the current key is an integer
476
494
int index = _asInteger (key);
0 commit comments