#26-Removing null from lineChange

This commit is contained in:
BarminaA 2021-04-24 19:23:44 +04:00
parent 4629562e0f
commit fb04c3bb1d

View File

@ -250,22 +250,32 @@ public class GitRepositoryService {
while ((i < stringsLength) && strings[i].startsWith("-")) {
if (strings[i].startsWith("---")) {
i++;
} else {
if (lineChange.getLineFrom() == null) {
lineChange.setLineFrom(strings[i]);
i++;
} else {
lineChange.setLineFrom(lineChange.getLineFrom() + "\n" + strings[i]);
i++;
}
}
}
}
if (strings[i].startsWith("+")) {
while ((i < stringsLength) && strings[i].startsWith("+")) {
if (strings[i].startsWith("+++")) {
i++;
} else {
if (lineChange.getLineTo() == null) {
lineChange.setLineTo(strings[i]);
i++;
} else {
lineChange.setLineTo(lineChange.getLineTo() + "\n" + strings[i]);
i++;
}
}
}
}
if ((lineChange.getLineTo() != null) || (lineChange.getLineFrom() != null)
|| ((lineChange.getLineTo() != null) && (lineChange.getLineFrom() != null))) {
fileChange.getLineChanges().add(lineChange);