[BUGFIX] Solved issue with possible nullpointer

This commit is contained in:
JKetelaar
2016-06-12 01:54:41 +02:00
parent 301c4dd42c
commit 5b79000bf5
+8 -5
View File
@@ -153,11 +153,14 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener,
String randString = StringUtils.randomString(10); String randString = StringUtils.randomString(10);
boolean search = true; boolean search = true;
boolean duplicate = false; boolean duplicate = false;
while (search == true) { while (search) {
for (File f : Directories.getScreenshotDir().listFiles()) { File[] files;
if (f.getAbsoluteFile().getName().contains(randString)) { if ((files = Directories.getScreenshotDir().listFiles()) != null) {
duplicate = true; for (File f : files) {
break; if (f.getAbsoluteFile().getName().contains(randString)) {
duplicate = true;
break;
}
} }
} }
if (!duplicate) { if (!duplicate) {