changeset 18:96cc73ae2904

Make it more fail-safe.
author David Barts <n5jrn@me.com>
date Tue, 21 Jan 2020 16:39:02 -0800
parents 9dd58db4d15a
children 5e0d1fe61da9
files src/name/blackcap/clipman/Pasteboard.kt
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/name/blackcap/clipman/Pasteboard.kt	Tue Jan 21 16:24:18 2020 -0800
+++ b/src/name/blackcap/clipman/Pasteboard.kt	Tue Jan 21 16:39:02 2020 -0800
@@ -84,7 +84,7 @@
                     is RTF -> {
                         put(DataFlavor.stringFlavor, item.plain as Any)
                         if (item.html != null) {
-                            put(HTML_FLAVOR, item.html?.toByteArray(CHARSET) as Any)
+                            put(HTML_FLAVOR, item.html!!.toByteArray(CHARSET) as Any)
                         }
                     }
                 }
@@ -103,6 +103,11 @@
         override fun lostOwnership(clipboard: Clipboard, contents: Transferable) {}
     }
 
+    /**
+     * Compare this PasteboardItem with another object.
+     * @param other object
+     * @return true iff this item's type and native content match the other's
+     */
     override operator fun equals(other: Any?): Boolean {
         return when (this) {
             is Plain -> (other is Plain) && (this.plain == other.plain)