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

Unified Diff: base/android/jni_string.cc

Issue 10916281: Make ConvertJavaToUTF functions more robusts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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: base/android/jni_string.cc
diff --git a/base/android/jni_string.cc b/base/android/jni_string.cc
index c8a90ca9e1012c9d97ac0e822350081c6937fd35..b830ddbb90823c5ae45c794d5c217baed92098df 100644
--- a/base/android/jni_string.cc
+++ b/base/android/jni_string.cc
@@ -48,6 +48,10 @@ ScopedJavaLocalRef<jstring> ConvertUTF8ToJavaString(
}
string16 ConvertJavaStringToUTF16(JNIEnv* env, jstring str) {
+ if (!str) {
+ LOG(WARNING) << " ConvertJavaStringToUTF16 called with null string.";
+ return string16();
+ }
const jchar* chars = env->GetStringChars(str, NULL);
DCHECK(chars);
// GetStringChars isn't required to NULL-terminate the strings
« 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