Skip to content

[Bug]: App crashes when filtering collection with an AI request present #1658

@Fikri-20

Description

@Fikri-20

Describe the bug

Typing anything in the collection filter/search box crashes the app if there is at least one AI-type request in the collection.

Steps to Reproduce

  1. Add a new request and switch its type to AI
  2. Type any character in the filter box in the left sidebar
  3. App crashes immediately

video illustrating the bug

filter-crash-ai-requests-compressed.mp4

Expected behavior

Filter works normally. AI requests are matched by name.

Root Cause

File: `lib/screens/home_page/collection_pane.dart`, line 149

Current code:

if (item.httpRequestModel!.url.toLowerCase().contains(filterQuery) ||
    item.name.toLowerCase().contains(filterQuery)) {

Problem: `httpRequestModel` is `null` for `APIType.ai` requests. Force-unwrapping it with `!` throws `Null check operator used on a null value` the moment the filter iterates over an AI request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions