commit d9b5fd78c90e334be86799be818a6256469e96d2
parent 8bc5d37dd1ee4d8293e2b13d2f2a759831a2fcf8
Author: Dan Stillman <dstillman@zotero.org>
Date: Tue, 21 Mar 2017 04:58:09 -0400
Fix error from empty strings in data generator
Diffstat:
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
@@ -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) {