@@ -173,7 +173,8 @@ inline MUST_USE_RESULT bool ParseArrayIndex(Local<Value> arg,
173173 return true ;
174174 }
175175
176- int64_t tmp_i = arg->IntegerValue ();
176+ CHECK (arg->IsNumber ());
177+ int64_t tmp_i = arg.As <Integer>()->Value ();
177178
178179 if (tmp_i < 0 )
179180 return false ;
@@ -769,7 +770,7 @@ void IndexOfString(const FunctionCallbackInfo<Value>& args) {
769770 SPREAD_BUFFER_ARG (args[0 ], ts_obj);
770771
771772 Local<String> needle = args[1 ].As <String>();
772- int64_t offset_i64 = args[2 ]-> IntegerValue ();
773+ int64_t offset_i64 = args[2 ]. As <Integer>()-> Value ();
773774 bool is_forward = args[4 ]->IsTrue ();
774775
775776 const char * haystack = ts_obj_data;
@@ -885,7 +886,7 @@ void IndexOfBuffer(const FunctionCallbackInfo<Value>& args) {
885886 THROW_AND_RETURN_UNLESS_BUFFER (Environment::GetCurrent (args), args[1 ]);
886887 SPREAD_BUFFER_ARG (args[0 ], ts_obj);
887888 SPREAD_BUFFER_ARG (args[1 ], buf);
888- int64_t offset_i64 = args[2 ]-> IntegerValue ();
889+ int64_t offset_i64 = args[2 ]. As <Integer>()-> Value ();
889890 bool is_forward = args[4 ]->IsTrue ();
890891
891892 const char * haystack = ts_obj_data;
@@ -955,7 +956,7 @@ void IndexOfNumber(const FunctionCallbackInfo<Value>& args) {
955956 SPREAD_BUFFER_ARG (args[0 ], ts_obj);
956957
957958 uint32_t needle = args[1 ].As <Uint32>()->Value ();
958- int64_t offset_i64 = args[2 ]-> IntegerValue ();
959+ int64_t offset_i64 = args[2 ]. As <Integer>()-> Value ();
959960 bool is_forward = args[3 ]->IsTrue ();
960961
961962 int64_t opt_offset = IndexOfOffset (ts_obj_length, offset_i64, 1 , is_forward);
0 commit comments