Check Matcher#find

Fixes #44
This commit is contained in:
Scott Burns
2019-04-22 18:32:03 +02:00
parent 92e362e5c9
commit f02ac6f13f

View File

@@ -129,9 +129,9 @@ public class FreezeTimersPlugin extends Plugin
final Pattern ppattern = Pattern.compile("> <col=ffffff>(.+?)<col=");
final Matcher smatch = spattern.matcher(event.getMenuTarget());
final Matcher pmatch = ppattern.matcher(event.getMenuTarget());
smatch.find();
pmatch.find();
if (smatch.group(1) != null && pmatch.group(1) != null)
if (smatch.find() && smatch.group(1) != null &&
pmatch.find() && pmatch.group(1) != null)
{
currticks = ticks;
spell = smatch.group(1);