diff --git a/lib/readline-sync.js b/lib/readline-sync.js index 3d3a1b6..e10db32 100644 --- a/lib/readline-sync.js +++ b/lib/readline-sync.js @@ -1190,7 +1190,7 @@ exports.keyInSelect = function(items, query, options) { }), // added: guide, cancel keylist = '', key2i = {}, charCode = 49 /* '1' */, display = '\n'; - if (!Array.isArray(items) || items.length > 35) + if (!Array.isArray(items) || !items.length || items.length > 35) { throw '`items` must be Array (max length: 35).'; } items.forEach(function(item, i) { diff --git a/package.json b/package.json index 8451025..7d2414d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "readline-sync", - "version": "1.2.15", + "version": "1.2.16", "title": "readlineSync", "description": "Synchronous Readline for interactively running to have a conversation with the user via a console(TTY).", "keywords": [