Skip to content

Commit

Permalink
Merge pull request #188 from SecUSo/fix/crash-with-missing-wifi-password
Browse files Browse the repository at this point in the history
Fix crash if wifi password is null for encrypted networks
  • Loading branch information
udenr authored Nov 9, 2023
2 parents c39f2c5 + 132f4a5 commit 9524745
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ public void onProceedPressed(final Context context) {
break;
case 1:
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.R) {
if ((!result.getNetworkEncryption().equalsIgnoreCase("NOPASS") && !result.getNetworkEncryption().equalsIgnoreCase(""))
&& pw == null) {
new MaterialAlertDialogBuilder(context)
.setTitle(android.R.string.dialog_alert_title)
.setMessage(R.string.cannot_connect_to_encrypted_wifi_without_password)
.setNegativeButton(android.R.string.ok, null)
.show();
return;
}
WifiNetworkSuggestion suggestion;
switch (result.getNetworkEncryption().toUpperCase()) {
case "NOPASS":
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@

<!-- ResultFragment -->
<string name="unsupported_wifi_encryption">Diese WiFi-Verschlüsselung wird derzeit nicht unterstützt: %1$s</string>
<string name="cannot_connect_to_encrypted_wifi_without_password">Ohne Passwort kann keine Verbindung zu einem verschlüsselten WiFi-Netzwerk hergestellt werden.</string>
<string name="ssid_value">SSID: %1$s</string>
<string name="encryption_value">Verschlüsselung: %1$s</string>
<string name="password_value">Passwort: %1$s</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@

<!-- ResultFragment -->
<string name="unsupported_wifi_encryption">This WiFi encryption is currently not supported: %1$s</string>
<string name="cannot_connect_to_encrypted_wifi_without_password">No connection to an encrypted WiFi network can be established without a password.</string>
<string name="ssid_value">SSID: %1$s</string>
<string name="encryption_value">Encryption: %1$s</string>
<string name="password_value">Password: %1$s</string>
Expand Down

0 comments on commit 9524745

Please sign in to comment.