Commit bcffdad7b68431c68b50ee74cad318656e85d8f5
1 parent
fe96d329
bundle判空异常处理
Showing
2 changed files
with
8 additions
and
9 deletions
OutSide_Share/src/main/java/com/cnlive/outside_share/activity/ShareMomentActivity.java
| @@ -322,9 +322,9 @@ public class ShareMomentActivity extends AppCompatActivity { | @@ -322,9 +322,9 @@ public class ShareMomentActivity extends AppCompatActivity { | ||
| 322 | } else { | 322 | } else { |
| 323 | canNotDo(); | 323 | canNotDo(); |
| 324 | } | 324 | } |
| 325 | - } else if (type.startsWith("image/") && bundle!=null) { | 325 | + } else if (type.startsWith("image/")) { |
| 326 | //兼容QQ浏览器链接类型 | 326 | //兼容QQ浏览器链接类型 |
| 327 | - if (bundle.get(TEXT) != null && bundle.getParcelable(Intent.EXTRA_STREAM) == null) { | 327 | + if (bundle!=null && bundle.get(TEXT) != null && bundle.getParcelable(Intent.EXTRA_STREAM) == null) { |
| 328 | String bundleText = bundle.get(TEXT) + ""; | 328 | String bundleText = bundle.get(TEXT) + ""; |
| 329 | if (bundleText.contains("@QQ浏览器") || bundleText.contains("html5.qq.com") || bundleText.contains("mbrowser.baidu.com")) { | 329 | if (bundleText.contains("@QQ浏览器") || bundleText.contains("html5.qq.com") || bundleText.contains("mbrowser.baidu.com")) { |
| 330 | String qqLink = bundleText.substring(bundleText.indexOf("http")); | 330 | String qqLink = bundleText.substring(bundleText.indexOf("http")); |
| @@ -339,7 +339,7 @@ public class ShareMomentActivity extends AppCompatActivity { | @@ -339,7 +339,7 @@ public class ShareMomentActivity extends AppCompatActivity { | ||
| 339 | shareConfig.shareRelease(context); | 339 | shareConfig.shareRelease(context); |
| 340 | finish(); | 340 | finish(); |
| 341 | } | 341 | } |
| 342 | - } else if (bundle.get(TEXT) == null && bundle.get("weixin_text") != null && (bundle.get("weixin_text") + "").contains("liebao.cn")) { //兼容舔狗猎豹浏览器内置图片分享问题 | 342 | + } else if (bundle!=null && bundle.get(TEXT) == null && bundle.get("weixin_text") != null && (bundle.get("weixin_text") + "").contains("liebao.cn")) { //兼容舔狗猎豹浏览器内置图片分享问题 |
| 343 | String weixin_text = (bundle.get("weixin_text") + "").substring((bundle.get("weixin_text") + "").indexOf("http")); | 343 | String weixin_text = (bundle.get("weixin_text") + "").substring((bundle.get("weixin_text") + "").indexOf("http")); |
| 344 | String weixin_title = bundle.get("weixin_title") + ""; | 344 | String weixin_title = bundle.get("weixin_title") + ""; |
| 345 | String weixin_img_url = bundle.get("weixin_img_url") + ""; | 345 | String weixin_img_url = bundle.get("weixin_img_url") + ""; |
| @@ -398,8 +398,8 @@ public class ShareMomentActivity extends AppCompatActivity { | @@ -398,8 +398,8 @@ public class ShareMomentActivity extends AppCompatActivity { | ||
| 398 | medialist.add(media); | 398 | medialist.add(media); |
| 399 | jumpReleaseActivity(context, medialist, 3, "", "nocircle"); | 399 | jumpReleaseActivity(context, medialist, 3, "", "nocircle"); |
| 400 | killTime(); | 400 | killTime(); |
| 401 | - } else if ((equals ? preferences.getString("extratext", null) : bundle.get(TEXT)) != null && | ||
| 402 | - bundle.get(TEXT) != null && !(bundle.get(TEXT) + "").contains("http")) { //腾讯文件Android Q | 401 | + } else if (equals ? preferences.getString("extratext", null)!= null : (bundle!=null && |
| 402 | + bundle.get(TEXT) != null && !(bundle.get(TEXT) + "").contains("http"))) { //腾讯文件Android Q | ||
| 403 | String pathImg = getPath(context, imageUri); | 403 | String pathImg = getPath(context, imageUri); |
| 404 | Uri mediaUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; | 404 | Uri mediaUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; |
| 405 | String[] projection = {MediaStore.Images.Media._ID, | 405 | String[] projection = {MediaStore.Images.Media._ID, |
| @@ -422,8 +422,7 @@ public class ShareMomentActivity extends AppCompatActivity { | @@ -422,8 +422,7 @@ public class ShareMomentActivity extends AppCompatActivity { | ||
| 422 | killTime(); | 422 | killTime(); |
| 423 | } | 423 | } |
| 424 | if (cursor != null) cursor.close(); | 424 | if (cursor != null) cursor.close(); |
| 425 | - } else if ((equals ? preferences.getString("extratext", null) : bundle.get(TEXT)) != null && | ||
| 426 | - bundle.get(TEXT) != null && (bundle.get(TEXT) + "").contains("http")) { // Q浏览器分享图片类型 | 425 | + } else if (equals ? preferences.getString("extratext", null) !=null : (bundle!=null && bundle.get(TEXT) != null && (bundle.get(TEXT) + "").contains("http"))) { // Q浏览器分享图片类型 |
| 427 | String link = equals ? preferences.getString("extratext", "") : bundle.get(TEXT) + ""; | 426 | String link = equals ? preferences.getString("extratext", "") : bundle.get(TEXT) + ""; |
| 428 | if (link.contains("http") && !link.startsWith("http")) { | 427 | if (link.contains("http") && !link.startsWith("http")) { |
| 429 | int begin = link.indexOf("http"); | 428 | int begin = link.indexOf("http"); |
| @@ -471,7 +470,7 @@ public class ShareMomentActivity extends AppCompatActivity { | @@ -471,7 +470,7 @@ public class ShareMomentActivity extends AppCompatActivity { | ||
| 471 | } | 470 | } |
| 472 | } | 471 | } |
| 473 | } | 472 | } |
| 474 | - } else if (type.startsWith("video/") && bundle!=null) { | 473 | + } else if (type.startsWith("video/")) { |
| 475 | Uri videoUri = equals ? Uri.parse(preferences.getString("extrastream", "")) : bundle.getParcelable(Intent.EXTRA_STREAM); | 474 | Uri videoUri = equals ? Uri.parse(preferences.getString("extrastream", "")) : bundle.getParcelable(Intent.EXTRA_STREAM); |
| 476 | if (videoUri == null) { | 475 | if (videoUri == null) { |
| 477 | canNotDo(); | 476 | canNotDo(); |
config.gradle