[vlc-devel] [vlc-commits] commit: Qt4: check that index.isValid too (Ilkka Ollakka )

Jakob Leben jakob.leben at gmail.com
Fri Jun 25 01:01:30 CEST 2010


On Thu, Jun 24, 2010 at 11:18 PM, <git at videolan.org> wrote:

> vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Thu Jun 24
> 18:06:25 2010 +0300| [f9fe9f294474e6c286ff458522e5dd373f92564d] | committer:
> Ilkka Ollakka
>
> diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp
> b/modules/gui/qt4/components/playlist/playlist_model.cpp
> index 75d885b..a1f1412 100644
> --- a/modules/gui/qt4/components/playlist/playlist_model.cpp
> +++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
> @@ -388,6 +388,9 @@ QVariant PLModel::data( const QModelIndex &index, int
> role ) const
>  /* Seek from current index toward the top and see if index is one of
> parent nodes */
>  bool PLModel::isParent( const QModelIndex &index, const QModelIndex
> &current ) const
>  {
> +    if( !index.isValid() )
> +        return false;
> +
>     if( index == current )
>         return true;
>

I don't see a reason for this. Invalid QModelIndex does not mean an error or
something like that, but means the top item. It is invalid simply because it
has no parent, therefore can not have a column and row position within any
parent.

And, again, since it is the one and only top item, it is a parent of any
other item.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20100625/ae510a23/attachment.html>


More information about the vlc-devel mailing list