Skip to content

Commit 4bf7327

Browse files
committed
Protect keys from being undefined or null
- bump version for this fix
1 parent feae08b commit 4bf7327

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hashtable",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Native HashTable and ES6 compatible Map for Node.js",
55
"main": "./index.js",
66
"keywords": [

src/hashtable.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ NAN_METHOD(HashTable::MapConstructor) {
102102
NAN_METHOD(HashTable::Get) {
103103
NanScope();
104104

105-
if (args.Length() < 1) {
105+
if (args.Length() < 1 || args[0]->IsUndefined() || args[0]->IsNull()) {
106106
NanThrowTypeError("Wrong arguments");
107107
NanReturnUndefined();
108108
}
@@ -122,7 +122,7 @@ NAN_METHOD(HashTable::Get) {
122122
NAN_METHOD(HashTable::Has) {
123123
NanScope();
124124

125-
if (args.Length() < 1) {
125+
if (args.Length() < 1 || args[0]->IsUndefined() || args[0]->IsNull()) {
126126
NanThrowTypeError("Wrong arguments");
127127
NanReturnUndefined();
128128
}
@@ -142,7 +142,7 @@ NAN_METHOD(HashTable::Has) {
142142
NAN_METHOD(HashTable::Put) {
143143
NanScope();
144144

145-
if (args.Length() < 2) {
145+
if (args.Length() < 2 || args[0]->IsUndefined() || args[0]->IsNull()) {
146146
NanThrowTypeError("Wrong arguments");
147147
NanReturnUndefined();
148148
}

0 commit comments

Comments
 (0)