Skip to content

Commit

Permalink
Better error handling for dragMouse.
Browse files Browse the repository at this point in the history
  • Loading branch information
octalmage committed Jan 8, 2016
1 parent ef2bdfc commit 93417d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/robotjs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int CheckMouseButton(const char * const b, MMMouseButton * const button)

NAN_METHOD(dragMouse)
{
if (info.Length() < 2)
if (info.Length() < 2 || info.Length() > 3)
{
return Nan::ThrowError("Invalid number of arguments.");
}
Expand All @@ -61,7 +61,7 @@ NAN_METHOD(dragMouse)
const size_t y = info[1]->Int32Value();
MMMouseButton button = LEFT_BUTTON;

if (info.Length() >= 3)
if (info.Length() == 3)
{
Nan::Utf8String bstr(info[2]);
const char * const b = *bstr;
Expand Down

0 comments on commit 93417d3

Please sign in to comment.