Profile: Use Optional for description

This commit is contained in:
Paul Schaub 2023-04-27 14:25:16 +02:00
parent aa88904711
commit c479cc8ef3
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
3 changed files with 171 additions and 7 deletions

View file

@ -38,8 +38,10 @@ public class ListProfilesExternal implements ListProfiles {
private static List<Profile> toProfiles(String output) {
List<Profile> profiles = new ArrayList<>();
for (String line : output.split("\n")) {
String[] split = line.split(": ");
profiles.add(new Profile(split[0], split[1]));
if (line.trim().isEmpty()) {
continue;
}
profiles.add(Profile.parse(line));
}
return profiles;
}