From f0618d633875a8248c67a381d50cea66e26c5043 Mon Sep 17 00:00:00 2001 From: Kristian Knarvik Date: Thu, 1 Feb 2018 13:56:57 +0100 Subject: [PATCH] Fixed the broken fix --- src/Main.java | 4 ++-- src/net/knarcraft/serverlauncher/server/Server.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Main.java b/src/Main.java index f3d90b7..f1fb25e 100644 --- a/src/Main.java +++ b/src/Main.java @@ -103,10 +103,10 @@ class Main { * @return The wanted substring. */ private static String stringBetween(String string, String start, String end) { - if (!string.contains(start)) { + int startPos = string.indexOf(start) + start.length(); + if (!string.contains(start) || string.indexOf(end, startPos) < startPos) { return ""; } - int startPos = string.indexOf(start) + start.length(); return string.substring(startPos, string.indexOf(end, startPos)); } } \ No newline at end of file diff --git a/src/net/knarcraft/serverlauncher/server/Server.java b/src/net/knarcraft/serverlauncher/server/Server.java index 57a57ca..39aaa65 100644 --- a/src/net/knarcraft/serverlauncher/server/Server.java +++ b/src/net/knarcraft/serverlauncher/server/Server.java @@ -350,10 +350,10 @@ public class Server { * @return The wanted substring. */ private static String stringBetween(String string, String start, String end) { - if (!string.contains(start)) { + int startPos = string.indexOf(start) + start.length(); + if (!string.contains(start) || string.indexOf(end, startPos) < startPos) { return ""; } - int startPos = string.indexOf(start) + start.length(); return string.substring(startPos, string.indexOf(end, startPos)); }