[
https://issues.apache.org/jira/browse/CB-12277?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16562598#comment-16562598
]
ASF GitHub Bot commented on CB-12277:
-------------------------------------
jcesarmobile closed pull request #149: CB-12277: (android) avoid
NullPointerException when removing splash-screen
URL: https://github.com/apache/cordova-plugin-splashscreen/pull/149
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/src/android/SplashScreen.java b/src/android/SplashScreen.java
index 6f56c6c6..428df336 100644
--- a/src/android/SplashScreen.java
+++ b/src/android/SplashScreen.java
@@ -219,7 +219,7 @@ public void onConfigurationChanged(Configuration newConfig)
{
private void removeSplashScreen(final boolean forceHideImmediately) {
cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
- if (splashDialog != null && splashDialog.isShowing()) {
+ if (splashDialog != null && splashImageView != null &&
splashDialog.isShowing()) {//check for non-null splashImageView, see
https://issues.apache.org/jira/browse/CB-12277
final int fadeSplashScreenDuration = getFadeDuration();
// CB-10692 If the plugin is being paused/destroyed, skip
the fading and hide it immediately
if (fadeSplashScreenDuration > 0 && forceHideImmediately
== false) {
@@ -238,7 +238,7 @@ public void onAnimationStart(Animation animation) {
@Override
public void onAnimationEnd(Animation animation) {
- if (splashDialog != null &&
splashDialog.isShowing()) {
+ if (splashDialog != null && splashImageView !=
null && splashDialog.isShowing()) {//check for non-null splashImageView, see
https://issues.apache.org/jira/browse/CB-12277
splashDialog.dismiss();
splashDialog = null;
splashImageView = null;
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Android, "SplashShowOnlyFirstTime"=true, crashes the app after re-opening it
> ----------------------------------------------------------------------------
>
> Key: CB-12277
> URL: https://issues.apache.org/jira/browse/CB-12277
> Project: Apache Cordova
> Issue Type: Bug
> Components: Ionic
> Affects Versions: 4.0.1
> Environment: Windows 7 x64, engine Android 6, ionic CLI 2.1.17, ionic
> 2 RC4
> Reporter: Musa Haidari
> Priority: Major
> Labels: android, cannot-reproduce, triaged
> Original Estimate: 2h
> Remaining Estimate: 2h
>
> The app shows the splash screen on start. I want to close it programatically
> using this.platform.exitApp(); and after opening it again, I want the splash
> screen to apear again. The default behavoiur is to show the splash screen for
> the first run only, and if we close it the way mentioned, the subsequent
> openings will not show the splash screen.
> To override that I used <preference name="SplashShowOnlyFirstTime"
> value="false" />. Using this, the app shows splash screen for the first time
> and when close the app as mentioned, and try opening it again, while it is
> still available in recent apps, the app crashes most of the times reporting
> this in ADB:
> 12-20 09:35:50.851 30375 30375 E AndroidRuntime: FATAL EXCEPTION: main
> 12-20 09:35:50.851 30375 30375 E AndroidRuntime: Process:
> com.mydomain.myapp, PID: 30375
> 12-20 09:35:50.851 30375 30375 E AndroidRuntime:
> java.lang.NullPointerException: Attempt to invoke virtual method 'void
> android.widget.ImageView.setAnimation(android.view.animation.Animation)' on a
> null object reference
> 12-20 09:35:50.851 30375 30375 E AndroidRuntime: at
> org.apache.cordova.splashscreen.SplashScreen$4.run(SplashScreen.java:227)
> 12-20 09:35:50.851 30375 30375 E AndroidRuntime: at
> android.app.Activity.runOnUiThread(Activity.java:6050)
> 12-20 09:35:50.851 30375 30375 E AndroidRuntime: at
> org.apache.cordova.splashscreen.SplashScreen.removeSplashScreen(SplashScreen.java:217)
> 12-20 09:35:50.851 30375 30375 E AndroidRuntime: at
> org.apache.cordova.splashscreen.SplashScreen.access$1000(SplashScreen.java:49)
> 12-20 09:35:50.851 30375 30375 E AndroidRuntime: at
> org.apache.cordova.splashscreen.SplashScreen$5$1.run(SplashScreen.java:330)
> 12-20 09:35:50.851 30375 30375 E AndroidRuntime: at
> android.os.Handler.handleCallback(Handler.java:739)
> 12-20 09:35:50.851 30375 30375 E AndroidRuntime: at
> android.os.Handler.dispatchMessage(Handler.java:95)
> 12-20 09:35:50.851 30375 30375 E AndroidRuntime: at
> android.os.Looper.loop(Looper.java:148)
> 12-20 09:35:50.851 30375 30375 E AndroidRuntime: at
> android.app.ActivityThread.main(ActivityThread.java:7325)
> 12-20 09:35:50.851 30375 30375 E AndroidRuntime: at
> java.lang.reflect.Method.invoke(Native Method)
> 12-20 09:35:50.851 30375 30375 E AndroidRuntime: at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
> 12-20 09:35:50.851 30375 30375 E AndroidRuntime: at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]