Skip to content

Talk mobile crash when starting new conversation – autocomplete returns empty user and null token triggers exception #58856

@zanonz

Description

@zanonz

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.

  1. filterExistingParticipants() is called with a null room token, causing a server exception.
  2. The autocomplete API returns a malformed empty user entry with empty id and label, which causes the mobile client to crash when rendering the contact list.

Steps to reproduce

  1. Open Nextcloud Talk mobile app
  2. Tap New conversation
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status

    Triaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions