Unverified Commit 78c2b52e authored by Igor Demin's avatar Igor Demin Committed by GitHub

Fix getting text from clipboard (#579)

* Fix getting text from clipboard

Sometimes, internal AWT implementation can't properly parse the clipboard data.

getData's docs say that it can throw IOException

* Return UnsupportedFlavorException
parent b6c8e6aa
......@@ -7,6 +7,7 @@ import java.awt.Toolkit
import java.awt.datatransfer.DataFlavor
import java.awt.datatransfer.StringSelection
import java.awt.datatransfer.UnsupportedFlavorException
import java.io.IOException
import java.net.URI
import javax.swing.UIManager
......@@ -60,6 +61,8 @@ internal actual fun ClipboardManager_getText(): String? {
systemClipboard?.getData(DataFlavor.stringFlavor) as String?
} catch (_: UnsupportedFlavorException) {
null
} catch (_: IOException) {
null
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment