Skip to content

Commit

Permalink
Allow empty/undefined user
Browse files Browse the repository at this point in the history
  • Loading branch information
mscdex committed Aug 19, 2012
1 parent 88f65e3 commit 3149c1b
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/client.cc
Expand Up @@ -380,12 +380,9 @@ class Client : public ObjectWrap {
Local<Value> compress_v = cfg->Get(String::New("compress"));
Local<Value> ssl_v = cfg->Get(String::New("secure"));

if (!user_v->IsString() || user_v->ToString()->Length() == 0) {
obj->close();
return ThrowException(Exception::Error(
String::New("`user` must be a non-empty string"))
);
} else {
if (!user_v->IsString() || user_v->ToString()->Length() == 0)
obj->config.user = NULL;
else {
String::Utf8Value user_s(user_v);
obj->config.user = strdup(*user_s);
}
Expand Down Expand Up @@ -429,7 +426,7 @@ class Client : public ObjectWrap {
String::New("Query expected"))
);
}
String::Utf8Value query(args[0]->ToString());
String::Utf8Value query(args[0]);
obj->query(*query);
return Undefined();
}
Expand Down

0 comments on commit 3149c1b

Please sign in to comment.