[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/graphics/kpovmodeler
From:       Christoph Feck <christoph () maxiom ! de>
Date:       2010-10-08 16:49:08
Message-ID: 20101008164908.370B0AC892 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1183913 by cfeck:

Fix wrong list access

Qt3 returned 0 for last() on empty lists. The port to Qt4
requires checking if the list is empty. In this port, however,
it accessed the element after end() iterator, instead of before
it, because of a wrong "cit" direction.

Instead of changing the direction, I use last() again to make
it clearer what the code does.

BUG: 214248


 M  +1 -7      pmpovrayparser.cpp  


--- trunk/extragear/graphics/kpovmodeler/pmpovrayparser.cpp #1183912:1183913
@@ -84,13 +84,7 @@
                commentText = m_pScanner->sValue( );
                if( lastCommentLine == ( m_pScanner->currentLine( ) - 1 ) )
                {
-						c = 0;
-						QList<PMComment*>::iterator cit = m_skippedComments.end();
-						if(cit != m_skippedComments.begin())
-						{
-							++cit;
-							c = *cit;
-						}
+                  c = m_skippedComments.isEmpty() ? 0 : m_skippedComments.last();
                   if( c )
                      c->setText( c->text( ) + '\n' + commentText );
                   else
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic