File tree 1 file changed +13
-11
lines changed
1 file changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -644,11 +644,11 @@ MaybeLocal<Value> StringBytes::Encode(Isolate* isolate,
644
644
return MaybeLocal<Value>();
645
645
}
646
646
auto maybe_buf = Buffer::Copy (isolate, buf, buflen);
647
- if (maybe_buf.IsEmpty ()) {
647
+ Local<v8::Object> buf;
648
+ if (!maybe_buf.ToLocal (&buf)) {
648
649
*error = node::ERR_MEMORY_ALLOCATION_FAILED (isolate);
649
- return MaybeLocal<Value>();
650
650
}
651
- return maybe_buf. ToLocalChecked () ;
651
+ return buf ;
652
652
}
653
653
654
654
case ASCII:
@@ -665,15 +665,17 @@ MaybeLocal<Value> StringBytes::Encode(Isolate* isolate,
665
665
}
666
666
667
667
case UTF8:
668
- val = String::NewFromUtf8 (isolate,
669
- buf,
670
- v8::NewStringType::kNormal ,
671
- buflen);
672
- if (val.IsEmpty ()) {
673
- *error = node::ERR_STRING_TOO_LONG (isolate);
674
- return MaybeLocal<Value>();
668
+ {
669
+ val = String::NewFromUtf8 (isolate,
670
+ buf,
671
+ v8::NewStringType::kNormal ,
672
+ buflen);
673
+ Local<String> str;
674
+ if (!val.ToLocal (&str)) {
675
+ *error = node::ERR_STRING_TOO_LONG (isolate);
676
+ }
677
+ return str;
675
678
}
676
- return val.ToLocalChecked ();
677
679
678
680
case LATIN1:
679
681
return ExternOneByteString::NewFromCopy (isolate, buf, buflen, error);
You can’t perform that action at this time.
0 commit comments