[Kde-pim] Review Request: avoid the use of an undefined collection

Kevin Krammer kevin.krammer at gmx.at
Tue Oct 4 18:44:39 BST 2011


Hi Guy,

On Tuesday, 2011-10-04, Guy Maurel wrote:

> mmmmh!
> The reason why I had a look on this file was the error message I got!
> This was  misleading.
> If all this is correct (I aggree you now), then we should find anything
> better, so that no error message will be generated?

Well, the error says that the job failed to fetch the resource collection, 
which is true in this case as well (no collection at all -> no resource 
collection).

> Such as a test:
>   bool test= false;
>   foreach...{
>     if( ... {
>       ...
>       test= true;
>       break;
>     }
>   }
>   ...
>    if ( !resourceCollection.isValid() ) {
>      if( test) {
>        q->setError( Job::Unknown );
>        ...
>        return;

Hmm, I am not sure this would change anything. If you set test to true in the 
same if that sets resourceCollection, the value for test is basically the 
equivalent of resourceCollection.isValid()
So if this is false, test will be false so the if body will not execute.
If it is true, test will be true but the if well not be reaches since 
!resourceCollection.isValid already did not enter the outer if body.

Cheers,
Kevin

-- 
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20111004/e35973aa/attachment.sig>
-------------- next part --------------
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/


More information about the kde-pim mailing list