Skip to content

Restore instance data in ImportConfirmationDialog before checking the data#13003

Closed
dustdfg wants to merge 1 commit intoTeamNewPipe:devfrom
dustdfg:soundclod_import
Closed

Restore instance data in ImportConfirmationDialog before checking the data#13003
dustdfg wants to merge 1 commit intoTeamNewPipe:devfrom
dustdfg:soundclod_import

Conversation

@dustdfg
Copy link
Contributor

@dustdfg dustdfg commented Jan 4, 2026

What is it?

  • Bugfix (user facing)

Description of the changes in your PR

Restore instance data in ImportConfirmationDialog before checking the data. Prevents crash on check of uninitialized data after screen rotation)

Before/After Screenshots/Screen Record

  • See issue

Fixes the following issue(s)

Relies on the following changes

APK testing

The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR. You can find more info and a video demonstration on this wiki page.

Due diligence

Footnotes

  1. I don't remember correct word but I hope you understood

… data

Prevents crash on check of uninitialized data after screen rotation

Co-authored-by: Siddhesh Dhainje <siddheshdhainje2001@gmail.com>
@github-actions github-actions bot added size/small PRs with less than 50 changed lines size/medium PRs with less than 250 changed lines and removed size/small PRs with less than 50 changed lines labels Jan 4, 2026
@github-actions github-actions bot added size/small PRs with less than 50 changed lines and removed size/medium PRs with less than 250 changed lines labels Jan 4, 2026
Comment on lines +52 to 55
Bridge.restoreInstanceState(this, savedInstanceState);
if (resultServiceIntent == null) {
throw new IllegalStateException("Result intent is null");
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we even need this check after it? We either set value via show method (100%) either it will be restored (from automatically stored state).

Is there any possibility that after we saved correct state (100%) in onCreate we will still receive null?

.setCancelable(true)
.setNegativeButton(R.string.cancel, null)
.setPositiveButton(R.string.ok, (dialogInterface, i) -> {
if (resultServiceIntent != null && getContext() != null) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the same about checking resultServiceIntent.

getContextcheck could also be omitted? Especially because higher we use requireContext? But it is a part of callback. It is called later and probably not guaranteed to succeed later?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, in theory someone could use setResultServiceIntent() and set it to null. I therefore prefer the other PR because it mitigates this issue by removing the method completely.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, in theory someone could use setResultServiceIntent() and set it to null. I therefore prefer the other PR because it mitigates this issue by removing the method completely.

I was planning to merge that method with constructor but IIRC somewhere in history there was some explanation why it shouldn't be done. But it is not 100% because maybe I confused it with another file I was reading in recent days...

Copy link
Contributor

@TobiGr TobiGr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blocking for now

@dustdfg dustdfg closed this Jan 7, 2026
@dustdfg dustdfg deleted the soundclod_import branch January 7, 2026 18:53
@dustdfg
Copy link
Contributor Author

dustdfg commented Jan 8, 2026

@TobiGr found out that @State purge is actually even desired side effect \0/ so good job gating this PR

statesaver = "1.4.1" # TODO: Drop because it is deprecated and incompatible with KSP2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/small PRs with less than 50 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI error crash when rotating screen while typing url to import soundcloud file

2 participants