Skip to content

bug: Null crash in getVariableStatus when activeEnvironmentId absent from envMap #1699

@deepak0x

Description

@deepak0x

Description

envMap[activeEnvironmentId]! uses the null-assertion operator on a Map lookup, but Map.operator[] returns null when the key is absent. The guard only checks activeEnvironmentId != null, not whether that key exists in the map.

Steps to reproduce

  1. Open lib/utils/envvar_utils.dart around line 292
  2. Throws 'Null check operator used on a null value' at runtime if getVariableStatus is called with a non-null activeEnvironmentId that has no entry in envMap.

Expected behavior

envMap[activeEnvironmentId] returns null when the key is missing; the ! operator converts that null into an exception. The sibling function getEnvironmentTriggerSuggestions (line 263) correctly guards with && envMap[activeEnvironmentId] != null before the same lookup. should be handled correctly.

Actual behavior

Throws 'Null check operator used on a null value' at runtime if getVariableStatus is called with a non-null activeEnvironmentId that has no entry in envMap.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions