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

List:       kde-devel
Subject:    Re: Seg fault - what to do ?
From:       david () davidedmundson ! co ! uk
Date:       2008-08-21 9:53:47
Message-ID: 22481508.96521219312427116.JavaMail.servlet () kundenserver
[Download RAW message or body]

If tv->item(0,3) returns NULL your code then runs
"->text()" on NULL. Trying to run a function the object that NULL points to, is what causes a seg fault.

What he was suggesting was something like
if(tv->item(0,3))
{
 price = tv->item(0,3)->text();
}

>is this the right behavior ? should it not return null rather than
>crashing with seg fault ?
>
>>
>> On Wed, Aug 20, 2008 at 10:17 PM, Thiago Macieira <thiago@kde.org> wrote:
>>> On Wednesday 20 August 2008 18:31:02 Prashant Shah wrote:
>>>> Even this ...
>>>>
>>>> QString priceperunit = tv->item(0,3)->text();
>>>
>>> Have you checked if tv->item(0,3) is returning NULL?
> 
>>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe 
><<
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

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