diff --git a/app/src/main/kotlin/command/commands/Show.kt b/app/src/main/kotlin/command/commands/Show.kt index 2156337..ad57bc3 100644 --- a/app/src/main/kotlin/command/commands/Show.kt +++ b/app/src/main/kotlin/command/commands/Show.kt @@ -12,8 +12,12 @@ class Show( override val description = "show collection elements" override fun execute() { - for (product in collectionManager.getCollection()) { - io.println(product.toString()) + if (collectionManager.getCollection().isNotEmpty()) { + for (product in collectionManager.getCollection()) { + io.println(product.toString()) + } + } else { + io.println("коллекция пустая") } } }