Skip to content

Don't build .kra file if image is empty

Lucid Sunlight requested to merge awakening/krita:bug-429049 into master

Happens when drag&dropping empty layers.

Can cause modulo by zero crash in KisDocument::generatePreview when dragging onto canvas, or somewhere in QuaZip when dragging outside of Krita.

Also avoid showing a warning window when you drop empty layer onto canvas by avoiding hitting deserialization in application/x-krita-node and application/x-krita-node-url branches in KisMimeData::loadNodesKisMimeData::loadNodes (still adds a new empty layer).

Not too happy about this, as it now adds an assumption that x-krita-node and x-krita-node-url are the same node. Is there an edge case where they're not?


Test Plan

  • Create/open a document
  • Create an empty layer
  • Drag&drop it onto canvas
  • Don't crash

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