<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">On 7/9/22 02:28, thb--- via
      KMyMoney-devel wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:20220709062803.C73CD5101309@dd27714.kasserver.com">
      <pre class="moz-quote-pre" wrap="">Jack via KMyMoney-devel schrieb am 08.07.2022 18:33 (GMT +02:00):

On 2022.07.08 03:11, thb--- via KMyMoney-devel wrote:
</pre>
      <blockquote type="cite">
        <blockquote type="cite">
          <pre class="moz-quote-pre" wrap="">Jack via KMyMoney-devel schrieb am 07.07.2022 19:16 (GMT +02:00):

</pre>
          <blockquote type="cite">
            <pre class="moz-quote-pre" wrap="">I got several of these over the past days, but didn't report yet, as  
I wasn't sure I was on absolute latest.  I just recompiled from git  
master head, and get this (consistently) when saving an investment  
transaction, where I had changed the security.  Let me know if there  
is any other information which might be helpful.
</pre>
          </blockquote>
          <pre class="moz-quote-pre" wrap="">
Thanks for reporting. Despite all the details I have a problem to see  
where this happens. Mainly, because the backtrace does not (always)  
match my version of current master :(  It would be great, if you  
could simply specify the commit hash you are on in the future.

I am on 462fb8d2df6 and investtransactioneditor.cpp:1212 shows this  
for me
</pre>
        </blockquote>
        <pre class="moz-quote-pre" wrap="">
I am also on this - kmymoney -v shows "kmymoney 5.1.80-462fb8d2d" and  
here is a new BT

</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
[... bt removed ...]

</pre>
      <blockquote type="cite">
        <blockquote type="cite">
          <pre class="moz-quote-pre" wrap="">The problem though, as Jeremy already pointed out, is a div by zero  
but on (my) line 1212 there is no division at all. The only one in  
the vicinity is three lines further down and shows

  d->stockSplit.setPrice(d->stockSplit.value() /  
d->stockSplit.shares());

which only gets used for a stock split transaction and price mode set  
to PricePerTransaction.
</pre>
        </blockquote>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">Well, the BT does now point to this line, and I do have  
PricePerTransaction set, but this is a dividend transaction, not a  
split.  However, is this for a stock split, or if the transaction is  
NOT a stock split?  Is there a  wrong test in that "if"?
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
I should have written for "non stock split transactions". My fault and
the test in that "if" is perfectly OK.

The problem is/was, that a dividend transaction should have zero in the
shares attribute of the transaction. In that case, the division cannot work.</pre>
    </blockquote>
    I'll have to reconfirm I have the right version, but it looks like
    it, and I still crash.  The inner loop is if shares is zero, then
    divide by shares (depending on PriceMode).  Am I still misreading
    it?  (version shows <span style="font-family:monospace"><span
        style="color:#000000;background-color:#ffffff;">kmymoney
        5.1.80-352f01a87</span>.<br>
    </span>
    <blockquote type="cite"
      cite="mid:20220709062803.C73CD5101309@dd27714.kasserver.com">
      <pre class="moz-quote-pre" wrap="">I fixed another problem in that area, because one could edit a transaction,
make it a "buy", add shares, switch to dividend and save the transaction.
This would cause the number of shares erroneously being added to the account.
That one is also fixed with those two commits.

<a class="moz-txt-link-freetext" href="https://invent.kde.org/office/kmymoney/-/commit/0b0410a0ef51613824f2ddaf462efb207da478e0">https://invent.kde.org/office/kmymoney/-/commit/0b0410a0ef51613824f2ddaf462efb207da478e0</a>
<a class="moz-txt-link-freetext" href="https://invent.kde.org/office/kmymoney/-/commit/69de26b2640717373a40dd4191101d480ebe69ba">https://invent.kde.org/office/kmymoney/-/commit/69de26b2640717373a40dd4191101d480ebe69ba</a>

Thanks for all your help.

</pre>
    </blockquote>
  </body>
</html>