Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Unified Diff: ui/shell_dialogs/select_file_dialog_android.cc

Issue 16082002: Fix the Android implementation of SelectFile() SEGV when params is NULL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/shell_dialogs/select_file_dialog_android.cc
diff --git a/ui/shell_dialogs/select_file_dialog_android.cc b/ui/shell_dialogs/select_file_dialog_android.cc
index 2aa40073a028b14f4df5eb2bb98a046c0e2b8a68..6bed380d354721488e0680ad9c9639fbab03e6b2 100644
--- a/ui/shell_dialogs/select_file_dialog_android.cc
+++ b/ui/shell_dialogs/select_file_dialog_android.cc
@@ -62,15 +62,20 @@ void SelectFileDialogImpl::SelectFileImpl(
void* params) {
JNIEnv* env = base::android::AttachCurrentThread();
- std::vector<string16> accept_types =
- *(reinterpret_cast<std::vector<string16>*>(params));
-
- // The last string in params is expected to be the string with capture value.
- ScopedJavaLocalRef<jstring> capture_value =
- base::android::ConvertUTF16ToJavaString(env,
+ ScopedJavaLocalRef<jstring> capture_value;
+ std::vector<string16> accept_types;
+ if (params) {
+ accept_types = *(reinterpret_cast<std::vector<string16>*>(params));
+
+ // The last string in params is expected to be the string
+ // with capture value.
+ capture_value = base::android::ConvertUTF16ToJavaString(env,
StringToLowerASCII(accept_types.back()));
- base::android::CheckException(env);
- accept_types.pop_back();
+ base::android::CheckException(env);
+ accept_types.pop_back();
+ } else {
+ capture_value = base::android::ConvertUTF8ToJavaString(env, "filesystem");
+ }
// The rest params elements are expected to be accept_types.
ScopedJavaLocalRef<jobjectArray> accept_types_java =
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698