[Kmymoney-devel] CSV Importer - A new problem, crash on import

Chris DeveloperChris at rebel.com.au
Tue Apr 15 11:12:54 UTC 2014


Should have read...

At line line 1517 it is used to initialise '*m_topLine*' which in turn is 
used to initialise 'row' at line 1546

Chris

On 15/04/2014 8:23 PM, Chris wrote:
> Hi Allan
>
> Hoping you can give me some insight here.
>
> On windows when trying to import I get an exception. The application is 
> trying to dereference a null pointer with the usual consequence.
>
> The problem is after loading the table object with the imported file it 
> then tries to reference the cell location [-1,0] this returns a null 
> pointer and thus crashes.
>
> I have done a trace through the code and have discovered the following.
>
> The csvdialog object has a field called  m_startLine which by default is 
> set to 1.
> 101: m_startLine = 1;
>
> At line 640 in csvdialog.cpp it is set to default to zero if it doesn't 
> exist in the profile. This seems ok and I assume the +1 covers a boundary 
> condition
> 640: m_startLine = profilesGroup.readEntry("StartLine", -1) + 1; (was the 
> -1 meant to be 0?)
>
> At line 908 it is used as a parameter and decremented to -1
> 908: redrawWindow(m_startLine - 1);
>
> At line line 1517 it is used to initialise 'm_startLine' which in turn is 
> used to initialise 'row' at line 1546
>
> At line 1561, row (set to -1) is used to index the table
> 1561: label.setText(ui->tableWidget->item(*row*, col)->text());
>
> At that point it throws an exception as ui->tableWidget->item(row, col) 
> returns a null pointer (by design) and there is no checking of the return 
> value nor checking of the index before it is used.
>
> I assume this is a bug. What I am not sure about is what it should have 
> been set to to start with -1, 0 or 1? as I said the default before loading 
> a profile is 1.
>
> What really confuses me is on kubuntu I don't get an error with the same 
> import file (actually it crashed the first time, but didn't again after I 
> recreated the profile).
>
> Can you please advise where the error seems to be?
>
> Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20140415/9ca92863/attachment-0001.html>


More information about the KMyMoney-devel mailing list