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();
|
tag = tag.trim();
|
||||||
|
|
||||||
if (!tag.isEmpty()) {
|
if (!tag.isEmpty()) {
|
||||||
if (allProjectTags!= null && allProjectTags.containsKey(tag)) {
|
if (allProjectTags != null) {
|
||||||
allProjectTags.put(tag, allProjectTags.get(tag) + 1);
|
if (allProjectTags.containsKey(tag)) {
|
||||||
} else {
|
allProjectTags.put(tag, allProjectTags.get(tag) + 1);
|
||||||
allProjectTags.put(tag, 1);
|
} else {
|
||||||
|
allProjectTags.put(tag, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
polishedTags.add(tag);
|
polishedTags.add(tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lets update the project tags
|
// Lets update the project tags
|
||||||
@ -101,4 +103,4 @@ public class SetProjectTagsCommand extends Command {
|
|||||||
|
|
||||||
respond(response, "{ \"code\" : \"ok\" }");
|
respond(response, "{ \"code\" : \"ok\" }");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -194,7 +194,9 @@ public class FileProjectManager extends ProjectManager {
|
|||||||
|
|
||||||
protected void tarDir(String relative, File dir, TarOutputStream tos) throws IOException{
|
protected void tarDir(String relative, File dir, TarOutputStream tos) throws IOException{
|
||||||
File[] files = dir.listFiles();
|
File[] files = dir.listFiles();
|
||||||
|
if (files == null) return;
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
|
if (file == null) continue;
|
||||||
if (!file.isHidden()) {
|
if (!file.isHidden()) {
|
||||||
String path = relative + file.getName();
|
String path = relative + file.getName();
|
||||||
|
|
||||||
@ -333,7 +335,10 @@ public class FileProjectManager extends ProjectManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static protected void deleteDir(File dir) {
|
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()) {
|
if (file.isDirectory()) {
|
||||||
deleteDir(file);
|
deleteDir(file);
|
||||||
} else {
|
} else {
|
||||||
@ -377,7 +382,10 @@ public class FileProjectManager extends ProjectManager {
|
|||||||
|
|
||||||
protected void recover() {
|
protected void recover() {
|
||||||
boolean recovered = false;
|
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()) {
|
if (file.isDirectory() && !file.isHidden()) {
|
||||||
String dirName = file.getName();
|
String dirName = file.getName();
|
||||||
if (file.getName().endsWith(PROJECT_DIR_SUFFIX)) {
|
if (file.getName().endsWith(PROJECT_DIR_SUFFIX)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user