From 97922ff1295a7b76c85942407a327787325fdc87 Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 11 Mar 2019 10:28:09 +0000 Subject: [PATCH] Projucer: Avoid hitting an assertion in Random::nextInt() when using the --obfuscated-string-code command-line tool with strings containing fewer than 3 sections --- extras/Projucer/Source/Application/jucer_CommandLine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/Projucer/Source/Application/jucer_CommandLine.cpp b/extras/Projucer/Source/Application/jucer_CommandLine.cpp index 591a0b8340..13c9ff0c86 100644 --- a/extras/Projucer/Source/Application/jucer_CommandLine.cpp +++ b/extras/Projucer/Source/Application/jucer_CommandLine.cpp @@ -519,7 +519,7 @@ namespace if (length == 1) return "s" + String (start); - int breakPos = jlimit (1, length - 1, (length / 3) + rng.nextInt (length / 3)); + int breakPos = jlimit (1, length - 1, (length / 3) + rng.nextInt (jmax (1, length / 3))); return "(" + getStringConcatenationExpression (rng, start, breakPos) + " + " + getStringConcatenationExpression (rng, start + breakPos, length - breakPos) + ")";