diff --git a/src/jvmMain/kotlin/ai/hypergraph/kaliningraph/visualization/Utils.kt b/src/jvmMain/kotlin/ai/hypergraph/kaliningraph/visualization/Utils.kt index b29484f5..603e8dcd 100644 --- a/src/jvmMain/kotlin/ai/hypergraph/kaliningraph/visualization/Utils.kt +++ b/src/jvmMain/kotlin/ai/hypergraph/kaliningraph/visualization/Utils.kt @@ -29,9 +29,11 @@ fun MutableGraph.render(format: Format, layout: Engine = DOT): Renderer = toGraphviz().apply { engine(layout) }.render(format) fun String.alsoCopy() = also { - StringSelection(this).let { - Toolkit.getDefaultToolkit().systemClipboard.setContents(it, it) - } + try { + StringSelection(this).let { + Toolkit.getDefaultToolkit().systemClipboard.setContents(it, it) + } + } catch (e: Exception) { println("Error copying to clipboard: $e") } } fun String.show() = File.createTempFile("" + hashCode(), ".html")