# HG changeset patch # User David Barts # Date 1579653542 28800 # Node ID 96cc73ae2904860c7bfa93c56f0a51b7cc0f01ae # Parent 9dd58db4d15a312607ecf8dc11a98549fff659b4 Make it more fail-safe. diff -r 9dd58db4d15a -r 96cc73ae2904 src/name/blackcap/clipman/Pasteboard.kt --- 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)