【button】js_button padding新增判空

Signed-off-by: yyuanche <yuancheng25@huawei.com>

Change-Id: I1228b9a7f06493e682c10b9a492717996f88271b
This commit is contained in:
y30043833 2024-11-01 07:50:06 +00:00
parent b14806b970
commit a8cfded3d8

View File

@ -460,6 +460,7 @@ NG::PaddingProperty JSButton::GetNewPadding(const JSCallbackInfo& info)
NG::CalcLength(0.0) };
if (isLabelButton_) {
auto buttonTheme = GetTheme<ButtonTheme>();
CHECK_NULL_RETURN(buttonTheme, padding);
auto defaultPadding = buttonTheme->GetPadding();
padding = { NG::CalcLength(defaultPadding.Left()), NG::CalcLength(defaultPadding.Right()),
NG::CalcLength(defaultPadding.Top()), NG::CalcLength(defaultPadding.Bottom()) };