Merged
Conversation
Collaborator
aaudin90
commented
Jan 25, 2026
- Fix UninitializedPropertyAccessException crash when SDK methods are called before full initialization
- Changed lateinit var userId and deviceId to nullable types with proper null checks
- Cancel coroutine scopes on clear() to prevent race conditions
- Generate fallback UUID when userId is null in fallback mode
- Replace CoroutineExceptionHandler with explicit runCatchingCancellable blocks for better error handling
Contributor
|
@aaudin90 please add safety checks for subscriptions() and nonRenewingPurchases() methods |
…error handling Changed lateinit var userId and deviceId to nullable types to prevent UninitializedPropertyAccessException when SDK methods are called before initialization completes. Key changes: - userId and deviceId are now nullable with explicit null checks - isInitialized() checks for null instead of ::isInitialized - clear() cancels coroutine scopes and resets userId/deviceId to null - Public userId() and deviceId() methods return nullable types - Added null checks with ApphudError in RequestManager, PurchaseBodyFactory, RegistrationBodyFactory, and RegistrationProvider - Fallback mode generates UUID if userId is null - Added safety checks to subscriptions() and nonRenewingPurchases() Replaced CoroutineExceptionHandler with explicit runCatchingCancellable blocks for better error handling and proper CancellationException propagation: - Removed global errorHandler pattern - Wrapped coroutine code in runCatchingCancellable with explicit onFailure logging - Simplified toApphudError() extension function Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added ApphudInternal.userId setup in ApphudHasPremiumAccessTest to simulate initialized SDK state. Tests that expect active subscriptions or purchases now set userId before calling hasPremiumAccess(). Added userId cleanup in tearDown() to ensure test isolation. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added instruction to generate commit messages based strictly on actual diffs rather than copying old commit messages. This ensures accurate descriptions when restructuring commits. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1632bbb to
5987cde
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.