Commit 1302bf52 authored by Fabio D'Urso's avatar Fabio D'Urso Committed by Albert Astals Cid
Browse files

FormFieldChoice ctor: Stop scanning if /V is a string and the corresponding...

FormFieldChoice ctor: Stop scanning if /V is a string and the corresponding option has been identified
parent 401de95f
......@@ -1147,16 +1147,23 @@ FormFieldChoice::FormFieldChoice(PDFDoc *docA, Object *aobj, const Ref& ref, For
// However, if /Opt is an array of (exportVal,optionName) pairs, acroread
// seems to expect the exportVal instead of the optionName and so we do too.
if (Form::fieldLookup(dict, "V", &obj1)->isString()) {
GBool optionFound = gFalse;
for (int i = 0; i < numChoices; i++) {
if (choices[i].exportVal) {
if (choices[i].exportVal->cmp(obj1.getString()) == 0) {
choices[i].selected = true;
optionFound = gTrue;
}
} else if (choices[i].optionName) {
if (choices[i].optionName->cmp(obj1.getString()) == 0) {
choices[i].selected = true;
optionFound = gTrue;
}
}
if (optionFound) {
choices[i].selected = true;
break; // We've determined that this option is selected. No need to keep on scanning
}
}
} else if (obj1.isArray()) {
for (int i = 0; i < numChoices; i++) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment