GoogleFragment: Don't attempt to parse cookies if they are null
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -90,6 +90,8 @@ class GoogleFragment : Fragment(R.layout.fragment_google) {
|
|||||||
webViewClient = object : WebViewClient() {
|
webViewClient = object : WebViewClient() {
|
||||||
override fun onPageFinished(view: WebView, url: String) {
|
override fun onPageFinished(view: WebView, url: String) {
|
||||||
val cookies = CookieManager.getInstance().getCookie(url)
|
val cookies = CookieManager.getInstance().getCookie(url)
|
||||||
|
// cookies can be null if there is an error
|
||||||
|
if (cookies != null) {
|
||||||
val cookieMap = AC2DMUtil.parseCookieString(cookies)
|
val cookieMap = AC2DMUtil.parseCookieString(cookies)
|
||||||
if (cookieMap.isNotEmpty() && cookieMap[AUTH_TOKEN] != null) {
|
if (cookieMap.isNotEmpty() && cookieMap[AUTH_TOKEN] != null) {
|
||||||
val oauthToken = cookieMap[AUTH_TOKEN]
|
val oauthToken = cookieMap[AUTH_TOKEN]
|
||||||
@@ -100,6 +102,7 @@ class GoogleFragment : Fragment(R.layout.fragment_google) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
settings.apply {
|
settings.apply {
|
||||||
allowContentAccess = true
|
allowContentAccess = true
|
||||||
|
|||||||
Reference in New Issue
Block a user