Talk mobile crash when starting new conversation – autocomplete returns empty user and null token triggers exception
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
When creating a new conversation in the Nextcloud Talk mobile app, the application crashes immediately on both Android and iOS.
This appears to be caused by two server-side issues in the autocomplete endpoint used when creating a new conversation.
filterExistingParticipants()is called with a null room token, causing a server exception.- The autocomplete API returns a malformed empty user entry with empty
idandlabel, which causes the mobile client to crash when rendering the contact list.
Steps to reproduce
- Open Nextcloud Talk mobile app
- Tap New conversation
- App crashes immediately
The crash happens before any network request to create the room is completed.
Server error
The autocomplete endpoint is called without a room token:
GET /ocs/v2.php/core/autocomplete/get?search=&itemType=call&shareTypes[]=0&shareTypes[]=1&shareTypes[]=4&shareTypes[]=7
This produces a server error in Talk:
OCA\Talk\Collaboration\Collaborators\Listener::filterExistingParticipants():
Argument nextcloud/spreed#1 ($token) must be of type string, null given
Server log excerpt:
OCA\Talk\Collaboration\Collaborators\Listener::filterExistingParticipants():
Argument nextcloud/spreed#1 ($token) must be of type string, null given,
called in apps/spreed/lib/Collaboration/Collaborators/Listener.php
Malformed autocomplete entry
The autocomplete endpoint returns an invalid entry:
{
"id": "",
"label": "",
"icon": "icon-user",
"source": "users",
"status": "",
"subline": "",
"shareWithDisplayNameUnique": ""
}
This entry appears as the first element in the response.
Mobile crash
The Talk mobile client crashes when rendering this entry.
Android stack trace:
java.util.NoSuchElementException: Char sequence is empty.
at kotlin.text.StringsKt___StringsKt.first(_Strings.kt:77)
at com.nextcloud.talk.contacts.components.ContactsItemKt.ContactsItem
The crash happens because the UI attempts to call .first() on the empty label string.
Working fix
Two fixes resolve the issue:
1. Guard against null or empty room tokens
Prevent filterExistingParticipants() from being called when the token is missing.
$itemId = $event->getItemId();
if ($itemId === null || $itemId === '' || $itemId === 'new') {
return;
}
2. Filter malformed autocomplete entries
Remove results where label or shareWith are empty.
protected function filterMalformedUserResult(array $result): bool {
$shareWith = trim((string)($result['value']['shareWith'] ?? ''));
$label = trim((string)($result['label'] ?? ''));
return $shareWith !== '' && $label !== '';
}
Environment
Nextcloud version:
32.0.6
Talk app version:
22.0.9
Server:
Ubuntu 24.04
PHP 8.2
Redis enabled
Authentication:
OIDC (Authentik)
Reverse proxy:
Caddy
Cloudflare
Additional notes
The malformed entry appears even when users are valid and display names are properly configured.
Example of valid entries returned in the same response:
{
"id": "name@gmail.com",
"label": "John Snow",
"source": "users"
}
Only the first entry is malformed.
Impact
This causes:
- Talk mobile apps to crash immediately
- New conversations cannot be created
Filtering malformed autocomplete results and guarding against null tokens resolves the issue.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with apps/spreed/lib/Collaboration/Collaborators/Listener.php and trace the autocomplete request for a new conversation, where the room token is absent. Verify the endpoint no longer raises the null-token exception and that results with empty labels or identifiers are excluded, then reproduce the new-conversation flow in Talk mobile to confirm valid contacts remain available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100