Merge pull request #2198 from viniciusbds/master
Dealing with a possible null pointer dereference
This commit is contained in:
commit
0bd6a0fbd7
@ -86,13 +86,15 @@ public class SetProjectTagsCommand extends Command {
|
||||
tag = tag.trim();
|
||||
|
||||
if (!tag.isEmpty()) {
|
||||
if (allProjectTags!= null && allProjectTags.containsKey(tag)) {
|
||||
allProjectTags.put(tag, allProjectTags.get(tag) + 1);
|
||||
} else {
|
||||
allProjectTags.put(tag, 1);
|
||||
if (allProjectTags != null) {
|
||||
if (allProjectTags.containsKey(tag)) {
|
||||
allProjectTags.put(tag, allProjectTags.get(tag) + 1);
|
||||
} else {
|
||||
allProjectTags.put(tag, 1);
|
||||
}
|
||||
}
|
||||
polishedTags.add(tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Lets update the project tags
|
||||
@ -101,4 +103,4 @@ public class SetProjectTagsCommand extends Command {
|
||||
|
||||
respond(response, "{ \"code\" : \"ok\" }");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -194,7 +194,9 @@ public class FileProjectManager extends ProjectManager {
|
||||
|
||||
protected void tarDir(String relative, File dir, TarOutputStream tos) throws IOException{
|
||||
File[] files = dir.listFiles();
|
||||
if (files == null) return;
|
||||
for (File file : files) {
|
||||
if (file == null) continue;
|
||||
if (!file.isHidden()) {
|
||||
String path = relative + file.getName();
|
||||
|
||||
@ -333,7 +335,10 @@ public class FileProjectManager extends ProjectManager {
|
||||
}
|
||||
|
||||
static protected void deleteDir(File dir) {
|
||||
for (File file : dir.listFiles()) {
|
||||
File[] files = dir.listFiles();
|
||||
if (files == null) return;
|
||||
for (File file : files) {
|
||||
if (file == null) continue;
|
||||
if (file.isDirectory()) {
|
||||
deleteDir(file);
|
||||
} else {
|
||||
@ -377,7 +382,10 @@ public class FileProjectManager extends ProjectManager {
|
||||
|
||||
protected void recover() {
|
||||
boolean recovered = false;
|
||||
for (File file : _workspaceDir.listFiles()) {
|
||||
File[] files = _workspaceDir.listFiles();
|
||||
if (files == null) return;
|
||||
for (File file : files) {
|
||||
if (file == null) continue;
|
||||
if (file.isDirectory() && !file.isHidden()) {
|
||||
String dirName = file.getName();
|
||||
if (file.getName().endsWith(PROJECT_DIR_SUFFIX)) {
|
||||
|
Loading…
Reference in New Issue
Block a user