Add null-pointer safety check to KonqOperations::pasteInfo(const KUrl&) (to fix a crash on Wayland)

Review Request #118450 - Created June 1, 2014 and submitted

Information
Frank Reininghaus
kde-baseapps
master
335053
Reviewers
kde-baseapps
dfaure
According to a recent bug report, QApplication::clipboard()->mimeData() may return 0 on Wayland, which causes Dolphin to crash on startup (we check the clipboard contents on startup to determine the text of the "Paste" action).

While this is might be a bug in Qt's Wayland support itself (I could not do any tests myself because I have not worked with Wayland yet), we can at least try to work around the problem by checking the return value of that function before we dereference the pointer.

This patch is for master, even though master can probably not be used on Wayland at all, but I think that adding a null-pointer check already there and merging it to frameworks then does not hurt. If it is preferred to fix this in the frameworks branch only, this is also fine for me.
Updating the text of the paste action still seems to work fine. I could not test if it fixes the crash, but I'm pretty sure that at least a crash with the reported backtrace will not happen any more.
David Faure
Commit Hook
This review has been submitted with commit 7828b057da0491f1b08bfaec681067e195d7b6ca by Frank Reininghaus to branch master.
Frank Reininghaus
Review request changed

Status: Closed (submitted)

Loading...