Skip to content

GPBDictionary is incorrectly marking objectForKey: as nonnull due to NS_ASSUME_NONNULL_BEGIN Macro #22403

Open
@luoshuaiqing

Description

@luoshuaiqing

What version of protobuf and what language are you using?
Version: 28.3
Language: Objective-C

What operating system (Linux, Windows, ...) and version?
MacOS

What did you do?
Root Cause:

  • GPBDictionary is incorrectly marking objectForKey: as nonnull due to NS_ASSUME_NONNULL_BEGIN Macro

Problem it caused for me:

  • When I call this method from swift, it will crash the App if the key doesn't exist in the GPBDictionary because objc marks it as nonnull while it is actual returning null, and therefore Swift recognizes as a non-optional object while it is actually a nil.

Metadata

Metadata

Assignees

No one assigned

    Labels

    untriagedauto added to all issues by default when created.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions