Bug 445458

Summary: Investment Cap Gains by Account (Customized) crashes with my dataset. Changing the date of one ledger entry fixes the crash.
Product: [Applications] kmymoney Reporter: Dr. John-Patrick Lestrade <Patrick>
Component: reportsAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version First Reported In: 5.1.2   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 5.1.3
Sentry Crash Report:
Attachments: Kmymoney file for client Walter White.

Description Dr. John-Patrick Lestrade 2021-11-14 04:22:16 UTC
Created attachment 143529 [details]
Kmymoney file for client Walter White.

SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Load my file KM1.kmy
2. Go to Reports and choose Inv. Cap Gains by Account (Custom) (N.B. I did not create that custom report)
3. Crash. Restart
4. Go into ledger for "MethProfits". Change the date of the 737.85 ADDED Shares from 10/10/17 to 10/10/10 (mm/dd/yy)
5. Repeat step 3 above. This time it does not crash.

OBSERVED RESULT
Wife leaves me. etc

EXPECTED RESULT


SOFTWARE/OS VERSIONS
Ubuntu/Gnome 

ADDITIONAL INFORMATION
Comment 1 Thomas Baumgart 2021-11-14 10:17:49 UTC
Git commit 16afce344c239ac7b1919dbff3d7f638ca4ac3cf by Thomas Baumgart.
Committed on 14/11/2021 at 10:13.
Pushed by tbaumgart into branch 'master'.

Prevent a division by zero in  Investment Cap Gains reports

When the sum of all buys in the reporting period was zero a division by
zero could happen

M  +9    -4    kmymoney/plugins/views/reports/core/querytable.cpp

https://invent.kde.org/office/kmymoney/commit/16afce344c239ac7b1919dbff3d7f638ca4ac3cf
Comment 2 Thomas Baumgart 2021-11-14 12:23:14 UTC
Git commit f11f53c8a61495c6ac65e938075af9f8a106d481 by Thomas Baumgart.
Committed on 14/11/2021 at 12:22.
Pushed by tbaumgart into branch '5.1'.

Prevent a division by zero in Investment Cap Gains reports

When the sum of all buys in the reporting period was zero a division by
zero could happen
FIXED-IN: 5.1.3

(cherry picked from commit 16afce344c239ac7b1919dbff3d7f638ca4ac3cf)

M  +9    -4    kmymoney/plugins/views/reports/core/querytable.cpp

https://invent.kde.org/office/kmymoney/commit/f11f53c8a61495c6ac65e938075af9f8a106d481