Skip to content

Commit 3086b81

Browse files
committed
Fix #14532.
1 parent fc62ac5 commit 3086b81

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

osx/src/main/java/ch/cyberduck/ui/cocoa/controller/PreferencesController.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
import java.util.EnumSet;
7474
import java.util.LinkedHashMap;
7575
import java.util.Map;
76+
import java.util.Set;
7677
import java.util.StringTokenizer;
7778
import java.util.concurrent.Callable;
7879
import java.util.concurrent.Executors;
@@ -2175,7 +2176,9 @@ public void setDefaultBucketLocation(NSPopUpButton b) {
21752176
this.defaultBucketLocation = b;
21762177
this.defaultBucketLocation.setAutoenablesItems(false);
21772178
this.defaultBucketLocation.removeAllItems();
2178-
ProtocolFactory.get().forType(Protocol.Type.s3).getRegions().stream().sorted(Comparator.comparing(Location.Name::toString)).forEach(location -> {
2179+
final Protocol protocol = ProtocolFactory.get().forType(Protocol.Type.s3);
2180+
final Set<Location.Name> regions = null == protocol ? Collections.emptySet() : protocol.getRegions();
2181+
regions.stream().sorted(Comparator.comparing(Location.Name::toString)).forEach(location -> {
21792182
this.defaultBucketLocation.addItemWithTitle(location.toString());
21802183
this.defaultBucketLocation.lastItem().setRepresentedObject(location.getIdentifier());
21812184
});
@@ -2197,7 +2200,9 @@ public void setDefaultStorageClassPopup(NSPopUpButton b) {
21972200
this.defaultStorageClassPopup = b;
21982201
this.defaultStorageClassPopup.setAutoenablesItems(false);
21992202
this.defaultStorageClassPopup.removeAllItems();
2200-
for(String s : PreferencesReader.toList(ProtocolFactory.get().forType(Protocol.Type.s3).getProperties().get("s3.storage.class.options"))) {
2203+
final Protocol protocol = ProtocolFactory.get().forType(Protocol.Type.s3);
2204+
final Map<String, String> properties = null == protocol ? Collections.emptyMap() : protocol.getProperties();
2205+
for(String s : PreferencesReader.toList(properties.get("s3.storage.class.options"))) {
22012206
this.defaultStorageClassPopup.addItemWithTitle(LocaleFactory.localizedString(s, "S3"));
22022207
this.defaultStorageClassPopup.lastItem().setRepresentedObject(s);
22032208
}
@@ -2273,7 +2278,9 @@ public void setDefaultBucketLocationGoogleStorage(NSPopUpButton b) {
22732278
this.defaultBucketLocationGoogleStorage = b;
22742279
this.defaultBucketLocationGoogleStorage.setAutoenablesItems(false);
22752280
this.defaultBucketLocationGoogleStorage.removeAllItems();
2276-
ProtocolFactory.get().forType(Protocol.Type.googlestorage).getRegions().stream().sorted(Comparator.comparing(Location.Name::toString)).forEach(location -> {
2281+
final Protocol protocol = ProtocolFactory.get().forType(Protocol.Type.googlestorage);
2282+
final Set<Location.Name> regions = null == protocol ? Collections.emptySet() : protocol.getRegions();
2283+
regions.stream().sorted(Comparator.comparing(Location.Name::toString)).forEach(location -> {
22772284
this.defaultBucketLocationGoogleStorage.addItemWithTitle(location.toString());
22782285
this.defaultBucketLocationGoogleStorage.lastItem().setRepresentedObject(location.getIdentifier());
22792286
});

0 commit comments

Comments
 (0)