Skip to content

Fix Coverity issues February 2023

Fixed some Coverity issues, mostly dynamic_cast result being checked for null (which was usually just an assert).

My basic guideline for types of asserts:

  • when I can safely opt out of the code (for example it was just GUI etc.), I use KIS_SAFE_ASSERT_RECOVER_RETURN
  • when I have no idea what's going on or how safe it could be, but also it should never happen, I use Q_ASSERT
  • when there are other asserts around, I use the same type
  • Frankly I was a bit lost there sometimes when to use KIS_ASSERT for example... especially KIS_ASSERT vs Q_ASSERT.

Test Plan

  • run tests, make sure I haven't ruined anything
  • check in Coverity if the fixed issues are actually fixed (sometimes Coverity merges several similar issues in one file into one "Coverity issue" but I forget to check and fix only one "occurance" of the issue in the file).

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.

Merge request reports

Loading