Fix/6404 app crashes theme change multi upload #6429
+143
−72
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request addresses the crashes in the image upload flow of the app, specifically targeting issue #6404 (App crashes when switching between light and dark theme). Theese changes ensure that handling of activity recreation and state restoration, improving stability during theme changes, rotation, and process death.
Changes Made
IndexOutOfBoundsException
insetUploadMediaDetails
by adding validation foruploadItemIndex
anduploadItems
list size, preventing crashes when the list is empty during activity recreation .IndexOutOfBoundsException
by safely handling saved state andindexOfFragment
inonViewCreated
, ensuringsetUploadMediaDetails
is only called with valid data .UninitializedPropertyAccessException
by safely initializing and accessingimageAdapter
inonCreateView
,onDestroy
, and other methods, adding checks for initialization state .Unresolved reference: setImageToBeUploaded
compilation error by replacing it with direct field assignments and deferredinitializeFragment
calls, ensuring proper fragment setup .Verification
CustomSelectorActivity
,ImageFragment
,UploadActivity
, orUploadMediaDetailFragment
.Timber
logging across all changed files to aid debugging.Closes #6404