[ve] Add more checks for theme values

This commit is contained in:
Fedor Kobyakov
2025-07-28 17:21:32 +03:00
parent e9c081b740
commit 88c2a9eda9
2 changed files with 17 additions and 14 deletions

View File

@ -156,20 +156,22 @@ AscFormat.CTheme.prototype.getFillStyle = function (idx, unicolor, isConnectorSh
let fmtScheme = (isConnectorShape && this.themeElements.themeExt) ?
this.themeElements.themeExt.fmtConnectorScheme :
this.themeElements.fmtScheme;
if (idx >= 1 && idx <= 999) {
if (fmtScheme.fillStyleLst[idx - 1]) {
ret = fmtScheme.fillStyleLst[idx - 1].createDuplicate();
if (ret) {
ret.checkPhColor(unicolor, false);
return ret;
if (fmtScheme) {
if (idx >= 1 && idx <= 999) {
if (fmtScheme.fillStyleLst[idx - 1]) {
ret = fmtScheme.fillStyleLst[idx - 1].createDuplicate();
if (ret) {
ret.checkPhColor(unicolor, false);
return ret;
}
}
}
} else if (idx >= 1001) {
if (fmtScheme.bgFillStyleLst[idx - 1001]) {
ret = fmtScheme.bgFillStyleLst[idx - 1001].createDuplicate();
if (ret) {
ret.checkPhColor(unicolor, false);
return ret;
} else if (idx >= 1001) {
if (fmtScheme.bgFillStyleLst[idx - 1001]) {
ret = fmtScheme.bgFillStyleLst[idx - 1001].createDuplicate();
if (ret) {
ret.checkPhColor(unicolor, false);
return ret;
}
}
}
}

View File

@ -446,7 +446,8 @@
result = getMedifiersResult && getMedifiersResult.fontPropsObject.color;
} else if (cellName === "FillForegnd" || cellName === "FillBkgnd") {
//leave result because it is fill
if (getMedifiersResult.fill.type === Asc.c_oAscFill.FILL_TYPE_PATT) {
if (getMedifiersResult && getMedifiersResult.fill &&
getMedifiersResult.fill.type === Asc.c_oAscFill.FILL_TYPE_PATT) {
let uniColor;
if (cellName === "FillForegnd") {
uniColor = getMedifiersResult.fill.fgClr;