Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/env.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,16 @@ NAN_METHOD(EnvWrap::openDbi) {

const unsigned argc = 2;
Local<Value> argv[argc] = { info.This(), info[0] };

// Ensure env has been opened.
// A hacky way to do that, it to check whether me_path has been set.
EnvWrap *ew = Nan::ObjectWrap::Unwrap<EnvWrap>(info.This());
const char* path = nullptr;
int rc = mdb_env_get_path(ew->env, &path);
if (path == nullptr) {
return Nan::ThrowError("The environment is not open.");
}

Nan::MaybeLocal<Object> maybeInstance = Nan::NewInstance(Nan::New(*dbiCtor), argc, argv);

// Check if database could be opened
Expand Down