Skip to content

QAbstractItemView: don't access invalid indexes on copy-key

When pressing the copy key the view tried to access the model's data for the currentIndex() without checking whether the index is valid. This resulted in debug output to the console, and might break models that didn't check incoming indexes for validity (or asserted validity).

Fix this by checking whether the currentIndex() is valid before reading the model's data for that index.

Fixes: QTBUG-106569 Pick-to: 6.5 6.4 6.2 5.15 Change-Id: Ide75fbdfdbd1451ab6d48f07b22136553c5b2468 Reviewed-by: Richard Moe Gustavsen richard.gustavsen@qt.io (cherry picked from commit 3a0c33da)

Merge request reports