beemdevelopment/Aegis · error · ActivityNotFoundException
The intent was null or empty!
Error message
The intent was null or empty!
What it means
TrustedIntents.startActivity() throws ActivityNotFoundException with this message when isIntentSane(intent) fails, i.e. the Intent is null or has no action/data/component (empty). The library refuses to dispatch an intent it cannot validate against pinned receiver certificates, since sanity checking is a prerequisite for resolving the trusted target app.
Solutions
- Ensure the Intent passed to startActivity() is non-null and has an action and/or component set before calling (e.g. new Intent(context, TargetActivity.class) or new Intent(ACTION).setPackage(pkg)).
- Guard the call site: check intent != null and intent.getAction() != null (or component != null) before invoking startActivity.
- If intent may legitimately be absent, skip the call or fall back to plain Context.startActivity instead.
- Check isIntentSane() yourself (it is public) to get the precise failure before dispatching.
Example fix
// before
trustedIntents.startActivity(context, intent); // intent may be null or bare
// after
if (intent == null || intent.getAction() == null && intent.getComponent() == null) {
intent = new Intent(context, ReceiverActivity.class);
}
trustedIntents.startActivity(context, intent); Defensive patterns
Strategy: validation
Validate before calling
if (intent != null && (intent.getAction() != null || intent.getComponent() != null || intent.getData() != null)) {
trustedIntents.startActivity(context, intent);
} Type guard
boolean isIntentUsable(Intent intent) {
return intent != null
&& (intent.getAction() != null || intent.getComponent() != null || intent.getData() != null);
} Try / catch
try {
trustedIntents.startActivity(context, intent);
} catch (ActivityNotFoundException e) {
Log.w(TAG, "Intent not sane or no trusted receiver: " + e.getMessage());
// fall back to default startActivity or notify user
} Prevention
- Always construct the Intent with an explicit action or component before handing it to TrustedIntents.
- Validate with the library's own public isIntentSane(intent) before dispatching.
- Never pass a possibly-null Intent; initialize it at declaration or fail fast earlier.
- Add a unit test asserting every intent your app dispatches via TrustedIntents passes isIntentSane().
When it happens
Trigger: Calling startActivity(context, null); or calling it with a bare new Intent("") / new Intent() that has no action, data URI, or component set, so isIntentSane() returns false.
Common situations: Constructing the Intent conditionally and passing null when an early branch was skipped; building an Intent with only extras or only a package name but no action/component; refactoring code that previously used Context.startActivity directly, which tolerates vaguer intents, onto TrustedIntents which does not.
Related errors
- Invalid number of iterations for PBKDF
- Unexpectedly high number of iterations
- Secret is empty
- bad period
- Invalid Yandex secret length
AI-assisted analysis of beemdevelopment/Aegis@d6f4e5925a (2026-09-08).
Data as JSON: /api/errors/5590f1bbf8b04647.
Report an issue: GitHub.
Appendix: source
Thrown at app/src/main/java/info/guardianproject/trustedintents/TrustedIntents.java:257
}
public boolean areSignaturesEqual(Signature[] sigs0, Signature[] sigs1) {
// TODO where is Android's implementation of this that I can just call?
if (sigs0 == null || sigs1 == null)
return false;
if (sigs0.length == 0 || sigs1.length == 0)
return false;
if (sigs0.length != sigs1.length)
return false;
for (int i = 0; i < sigs0.length; i++)
if (!sigs0[i].equals(sigs1[i]))
return false;
return true;
}
public void startActivity(Context context, Intent intent) throws CertificateException {
if (!isIntentSane(intent))
throw new ActivityNotFoundException("The intent was null or empty!");
String packageName = intent.getPackage();
if (TextUtils.isEmpty(packageName)) {
packageName = intent.getComponent().getPackageName();
intent.setPackage(packageName);
}
try {
checkTrustedSigner(packageName);
} catch (NameNotFoundException e) {
e.printStackTrace();
throw new ActivityNotFoundException(e.getLocalizedMessage());
}
context.startActivity(intent);
}
}
View on GitHub (pinned to d6f4e5925a)