diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/styles/qstyleanimation.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/widgets/styles/qstyleanimation.cpp b/src/widgets/styles/qstyleanimation.cpp index 297a929970..6173dc9ddb 100644 --- a/src/widgets/styles/qstyleanimation.cpp +++ b/src/widgets/styles/qstyleanimation.cpp @@ -83,15 +83,17 @@ bool QStyleAnimation::isUpdateNeeded() const void QStyleAnimation::updateCurrentTime(int) { - if (target()->isWidgetType()) { - QWidget *widget = static_cast<QWidget *>(target()); - if (!widget->isVisible() || widget->window()->isMinimized()) - stop(); - } - - if (isUpdateNeeded()) { - QEvent event(QEvent::StyleAnimationUpdate); - QCoreApplication::sendEvent(target(), &event); + if (QObject *tgt = target()) { + if (tgt->isWidgetType()) { + QWidget *widget = static_cast<QWidget *>(tgt); + if (!widget->isVisible() || widget->window()->isMinimized()) + stop(); + } + + if (isUpdateNeeded()) { + QEvent event(QEvent::StyleAnimationUpdate); + QCoreApplication::sendEvent(tgt, &event); + } } } |