fix nullptr issues

Signed-off-by: sunfei <sunfei.sun@huawei.com>
Change-Id:  I92e23f9a251ed01c672a177fa66e222ba60a7c5c
This commit is contained in:
kouxinxin
2021-10-15 14:57:43 +08:00
committed by sunfei
parent 843eda5823
commit bec6d3f72b
@@ -148,9 +148,11 @@ void JSSwiper::SetIndicator(bool showIndicator)
{
auto component = ViewStackProcessor::GetInstance()->GetMainComponent();
auto swiper = AceType::DynamicCast<OHOS::Ace::SwiperComponent>(component);
swiper->SetShowIndicator(showIndicator);
if (!showIndicator && swiper) {
swiper->SetIndicator(nullptr);
if (swiper) {
swiper->SetShowIndicator(showIndicator);
if (!showIndicator) {
swiper->SetIndicator(nullptr);
}
}
}