瀏覽代碼

do not allow empty display name for vault

Fixes #3633
Armin Schrenk 4 月之前
父節點
當前提交
fa16556af1
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      src/main/java/org/cryptomator/ui/vaultoptions/GeneralVaultOptionsController.java

+ 6 - 1
src/main/java/org/cryptomator/ui/vaultoptions/GeneralVaultOptionsController.java

@@ -57,9 +57,14 @@ public class GeneralVaultOptionsController implements FxController {
 	}
 
 	private void trimVaultNameOnFocusLoss(Observable observable, Boolean wasFocussed, Boolean isFocussed) {
+		var displayNameSetting = vault.getVaultSettings().displayName;
 		if (!isFocussed) {
 			var trimmed = vaultName.getText().trim();
-			vault.getVaultSettings().displayName.set(trimmed);
+			if (!trimmed.isEmpty()) {
+				displayNameSetting.set(trimmed); //persist changes
+			} else {
+				vaultName.setText(displayNameSetting.get()); //revert changes
+			}
 		}
 	}