@@ -1035,17 +1035,26 @@ static MaybeLocal<Value> GetX509NameObject(Environment* env, X509* cert) {
1035
1035
// change here without breaking things. Note that this creates nested data
1036
1036
// structures, yet still does not allow representing Distinguished Names
1037
1037
// accurately.
1038
- if (result->HasOwnProperty (env->context (), v8_name).ToChecked ()) {
1039
- Local<Value> accum =
1040
- result->Get (env->context (), v8_name).ToLocalChecked ();
1038
+ bool multiple;
1039
+ if (!result->HasOwnProperty (env->context (), v8_name).To (&multiple)) {
1040
+ return MaybeLocal<Value>();
1041
+ } else if (multiple) {
1042
+ Local<Value> accum;
1043
+ if (!result->Get (env->context (), v8_name).ToLocal (&accum)) {
1044
+ return MaybeLocal<Value>();
1045
+ }
1041
1046
if (!accum->IsArray ()) {
1042
1047
accum = Array::New (env->isolate (), &accum, 1 );
1043
- result->Set (env->context (), v8_name, accum).Check ();
1048
+ if (result->Set (env->context (), v8_name, accum).IsNothing ()) {
1049
+ return MaybeLocal<Value>();
1050
+ }
1044
1051
}
1045
1052
Local<Array> array = accum.As <Array>();
1046
- array->Set (env->context (), array->Length (), v8_value).Check ();
1047
- } else {
1048
- result->Set (env->context (), v8_name, v8_value).Check ();
1053
+ if (array->Set (env->context (), array->Length (), v8_value).IsNothing ()) {
1054
+ return MaybeLocal<Value>();
1055
+ }
1056
+ } else if (result->Set (env->context (), v8_name, v8_value).IsNothing ()) {
1057
+ return MaybeLocal<Value>();
1049
1058
}
1050
1059
}
1051
1060
0 commit comments