Skip to content

Commit 93417d3

Browse files
committed
Better error handling for dragMouse.
1 parent ef2bdfc commit 93417d3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/robotjs.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ int CheckMouseButton(const char * const b, MMMouseButton * const button)
5252

5353
NAN_METHOD(dragMouse)
5454
{
55-
if (info.Length() < 2)
55+
if (info.Length() < 2 || info.Length() > 3)
5656
{
5757
return Nan::ThrowError("Invalid number of arguments.");
5858
}
@@ -61,7 +61,7 @@ NAN_METHOD(dragMouse)
6161
const size_t y = info[1]->Int32Value();
6262
MMMouseButton button = LEFT_BUTTON;
6363

64-
if (info.Length() >= 3)
64+
if (info.Length() == 3)
6565
{
6666
Nan::Utf8String bstr(info[2]);
6767
const char * const b = *bstr;

0 commit comments

Comments
 (0)