@@ -1082,17 +1082,26 @@ static MaybeLocal<Value> GetX509NameObject(Environment* env, X509* cert) {
1082
1082
// change here without breaking things. Note that this creates nested data
1083
1083
// structures, yet still does not allow representing Distinguished Names
1084
1084
// accurately.
1085
- if (result->HasOwnProperty (env->context (), v8_name).ToChecked ()) {
1086
- Local<Value> accum =
1087
- result->Get (env->context (), v8_name).ToLocalChecked ();
1085
+ bool multiple;
1086
+ if (!result->HasOwnProperty (env->context (), v8_name).To (&multiple)) {
1087
+ return MaybeLocal<Value>();
1088
+ } else if (multiple) {
1089
+ Local<Value> accum;
1090
+ if (!result->Get (env->context (), v8_name).ToLocal (&accum)) {
1091
+ return MaybeLocal<Value>();
1092
+ }
1088
1093
if (!accum->IsArray ()) {
1089
1094
accum = Array::New (env->isolate (), &accum, 1 );
1090
- result->Set (env->context (), v8_name, accum).Check ();
1095
+ if (result->Set (env->context (), v8_name, accum).IsNothing ()) {
1096
+ return MaybeLocal<Value>();
1097
+ }
1091
1098
}
1092
1099
Local<Array> array = accum.As <Array>();
1093
- array->Set (env->context (), array->Length (), v8_value).Check ();
1094
- } else {
1095
- result->Set (env->context (), v8_name, v8_value).Check ();
1100
+ if (array->Set (env->context (), array->Length (), v8_value).IsNothing ()) {
1101
+ return MaybeLocal<Value>();
1102
+ }
1103
+ } else if (result->Set (env->context (), v8_name, v8_value).IsNothing ()) {
1104
+ return MaybeLocal<Value>();
1096
1105
}
1097
1106
}
1098
1107
0 commit comments