From 1cf95a5b2de2afec5507d52ab251eedaaefa6b07 Mon Sep 17 00:00:00 2001 From: Xu Tan Date: Thu, 21 Sep 2017 14:42:33 -0700 Subject: [PATCH] Add share format hint and fix a bug. (#43) The bug crashes the app if the providing share path is "\". This fixes #16 and #22. --- .../sambadocumentsprovider/mount/MountServerActivity.java | 3 +++ app/src/main/res/values/strings.xml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/google/android/sambadocumentsprovider/mount/MountServerActivity.java b/app/src/main/java/com/google/android/sambadocumentsprovider/mount/MountServerActivity.java index faccc5c..dbe3f42 100644 --- a/app/src/main/java/com/google/android/sambadocumentsprovider/mount/MountServerActivity.java +++ b/app/src/main/java/com/google/android/sambadocumentsprovider/mount/MountServerActivity.java @@ -362,6 +362,9 @@ public class MountServerActivity extends AppCompatActivity { final String path = mSharePathEditText.getText().toString(); if (path.startsWith("\\")) { // Possibly Windows share path + if (path.length() == 1) { + return null; + } final int endCharacter = path.endsWith("\\") ? path.length() - 1 : path.length(); final String[] components = path.substring(2, endCharacter).split("\\\\"); return components.length == 2 ? components : null; diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 86bc0e0..338d472 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -18,7 +18,7 @@ Android Samba Client - Share Path + Share Path e.g. smb://server/share Domain Username Password