[vlc-commits] Qt: plugins: check after casts.
Francois Cartegnie
git at videolan.org
Fri Feb 14 15:31:46 CET 2014
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Feb 14 15:31:23 2014 +0100| [8716719a779df2e0909ca911f0b6a9aea58b2e53] | committer: Francois Cartegnie
Qt: plugins: check after casts.
Really unlikely
cid #1174897
cid #1174898
cid #1174899
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8716719a779df2e0909ca911f0b6a9aea58b2e53
---
modules/gui/qt4/dialogs/plugins.cpp | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/modules/gui/qt4/dialogs/plugins.cpp b/modules/gui/qt4/dialogs/plugins.cpp
index 2b42410..b59a4f0 100644
--- a/modules/gui/qt4/dialogs/plugins.cpp
+++ b/modules/gui/qt4/dialogs/plugins.cpp
@@ -398,6 +398,7 @@ bool AddonsTab::eventFilter( QObject *obj, QEvent *event )
if ( spinnerAnimation->state() == PixmapAnimator::Running )
{
QWidget *viewport = qobject_cast<QWidget *>( obj );
+ if ( !viewport ) break;
QStylePainter painter( viewport );
QPixmap *spinner = spinnerAnimation->getPixmap();
QPoint point = viewport->geometry().center();
@@ -412,6 +413,7 @@ bool AddonsTab::eventFilter( QObject *obj, QEvent *event )
else if ( addonsModel->rowCount() == 0 )
{
QWidget *viewport = qobject_cast<QWidget *>( obj );
+ if ( !viewport ) break;
QStylePainter painter( viewport );
QString text = qtr("No addons found");
QSize size = fontMetrics().size( 0, text );
@@ -433,7 +435,8 @@ bool AddonsTab::eventFilter( QObject *obj, QEvent *event )
break;
case QEvent::DragEnter:
{
- QDragEnterEvent *dragEvent = dynamic_cast<QDragEnterEvent *>(event);
+ QDragEnterEvent *dragEvent = static_cast<QDragEnterEvent *>(event);
+ if ( !dragEvent ) break;
QList<QUrl> urls = dragEvent->mimeData()->urls();
if ( dragEvent->proposedAction() != Qt::CopyAction
|| urls.count() != 1
@@ -445,7 +448,8 @@ bool AddonsTab::eventFilter( QObject *obj, QEvent *event )
}
case QEvent::DragMove:
{
- QDragMoveEvent *moveEvent = dynamic_cast<QDragMoveEvent *>(event);
+ QDragMoveEvent *moveEvent = static_cast<QDragMoveEvent *>(event);
+ if ( !moveEvent ) break;
if ( moveEvent->proposedAction() != Qt::CopyAction )
return false;
moveEvent->acceptProposedAction();
@@ -453,7 +457,8 @@ bool AddonsTab::eventFilter( QObject *obj, QEvent *event )
}
case QEvent::Drop:
{
- QDropEvent *dropEvent = dynamic_cast<QDropEvent *>(event);
+ QDropEvent *dropEvent = static_cast<QDropEvent *>(event);
+ if ( !dropEvent ) break;
if ( dropEvent->proposedAction() != Qt::CopyAction )
return false;
if ( dropEvent->mimeData()->urls().count() )
@@ -481,6 +486,7 @@ void AddonsTab::moreInformation()
void AddonsTab::typeChanged( int i )
{
QComboBox *combo = qobject_cast<QComboBox *>( sender() );
+ if ( !combo ) return;
int i_type = combo->itemData( i, Qt::UserRole ).toInt();
addonsModel->setTypeFilter( i_type );
QString help;
@@ -640,8 +646,10 @@ QVariant ExtensionListModel::data( const QModelIndex& index, int role ) const
ExtensionCopy * extension =
static_cast<ExtensionCopy *>(index.internalPointer());
-
- return extension->data( role );
+ if ( !extension )
+ return QVariant();
+ else
+ return extension->data( role );
}
QModelIndex ExtensionListModel::index( int row, int column,
@@ -1163,6 +1171,7 @@ void AddonItemDelegate::setAnimator( DelegateAnimationHelper *animator_ )
void AddonItemDelegate::editButtonClicked()
{
QWidget *editor = qobject_cast<QWidget *>(sender()->parent());
+ if ( !editor ) return;
int value = editor->property("Addon::state").toInt();
if ( ( value == ADDON_INSTALLED ) )
/* uninstall */
More information about the vlc-commits
mailing list