Skip to content

Commit 4ab866a

Browse files
committed
Fix SODA createDocument argument validation
1 parent 2889bd4 commit 4ab866a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/njsSodaDatabase.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,15 @@ NAN_METHOD(njsSodaDatabase::CreateDocument)
314314
Local<Object> options;
315315
std::string key, mediaType, error;
316316
if (db->GetObjectArg(info, 1, options)) {
317-
njsUtils::GetStringFromJSON(options, "key", 1, key, error);
318-
njsUtils::GetStringFromJSON(options, "mediaType", 1, mediaType, error);
317+
if (!njsUtils::GetStringFromJSON(options, "key", 1, key, error)) {
318+
Nan::ThrowError(error.c_str());
319+
return;
320+
}
321+
if (!njsUtils::GetStringFromJSON(options, "mediaType", 1, mediaType,
322+
error)) {
323+
Nan::ThrowError(error.c_str());
324+
return;
325+
}
319326
}
320327

321328
// create ODPI-C document

0 commit comments

Comments
 (0)