fix: catch NotFoundException in CrowdinResources for non-app resource IDs#348
fix: catch NotFoundException in CrowdinResources for non-app resource IDs#348evanofficial wants to merge 3 commits intocrowdin:masterfrom
Conversation
… IDs Wrap getResourceEntryName() calls in try-catch so that resource IDs from system components (e.g. WebView/Chromium) that don't exist in the host app's resource table fall back to the parent Resources implementation instead of crashing with Resources$NotFoundException.
… non-app resource IDs
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 37e557a. Configure here.
| formattedString | ||
| } catch (_: NotFoundException) { | ||
| super.getText(id, default) | ||
| } |
There was a problem hiding this comment.
Quantity methods lack NotFoundException catch unlike other overrides
Medium Severity
The getQuantityText and getQuantityString methods lack the try-catch (NotFoundException) wrapper present in other Resources overrides. While their internal helpers now safely return null for non-app IDs, the fallback calls to the base res.getQuantityText or res.getQuantityString can still throw NotFoundException, causing crashes.
Reviewed by Cursor Bugbot for commit 37e557a. Configure here.
|
You have used all of your free Bugbot PR reviews. To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial. |


Fixes #347
When WebView (or other system components) call `getString()` with their own internal resource IDs, `CrowdinResources.getResourceEntryName()` throws `Resources$NotFoundException` because those IDs don't exist in the host app's resource table.
Wrap the resource lookup in a try-catch for `Resources.NotFoundException` and fall back to `super.getString()` when the resource ID is not from the host app.
Note
Medium Risk
Touches the core
Resourceswrapper used throughout the app; while the change is mainly defensive exception handling, incorrect fallbacks could subtly alter string/plural resolution behavior in edge cases.Overview
Prevents crashes when system components (e.g.,
WebView) callCrowdinResourceswith non-app resource IDs by catchingResources.NotFoundExceptioningetString,getString(vararg),getStringArray, andgetText, and falling back tosuperimplementations.Also hardens repository/plural handling by skipping reserve-resource persistence when an entry name can’t be resolved (
savePluralToCopy) and returningnullfrom repository lookups (getStringArrayFromRepository,getPluralFromRepository) when the ID isn’t found.Reviewed by Cursor Bugbot for commit 37e557a. Bugbot is set up for automated code reviews on this repo. Configure here.