From d9b5fd78c90e334be86799be818a6256469e96d2 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 21 Mar 2017 04:58:09 -0400 Subject: [PATCH] Fix error from empty strings in data generator --- chrome/content/zotero/tools/data_generator.html | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/chrome/content/zotero/tools/data_generator.html b/chrome/content/zotero/tools/data_generator.html index 5cadf4a1e..e87f9309a 100644 --- a/chrome/content/zotero/tools/data_generator.html +++ b/chrome/content/zotero/tools/data_generator.html @@ -79,13 +79,16 @@ var rand = Zotero.Utilities.rand; function randStr(min, max) { - return Zotero.Utilities.randomString( - rand(min, max), - "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" - + "éØü" - + "漢字" - + " " - ); + var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + + "éØü" + + "漢字" + + " " + do { + var rnd = Zotero.Utilities.randomString(rand(min, max), chars); + } + // Make sure string isn't all spaces + while (rnd.trim().length == 0); + return rnd; } function addCreatorOfType(creators, creatorType) {