Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'valueForKeyPath:' method in CPObjectController returns 'null marker' instead of nil #1987

Open
wants to merge 1 commit into
base: narwhal
Choose a base branch
from

Conversation

mrcarlberg
Copy link
Member

CPObjectController will return 'null marker' instead of nil when 'myAttribute' is nil in the following code:

[objectController valueForKeyPath:@"selection.myAttribute"]

The class '_CPControllerObjectProxy' returns the 'null marker' but it does not do it in Cocoa. I have a hard time figuring out how to solve this. I have only done the test case. Any help in doing this should be highly appreciated.

This might be related to #1986.

Here is a corresponding working test case for Objective-C:

- (void)testObjectControllerSelectionWithNil
{
    NSObjectController *controller = [[NSObjectController alloc] init];
    [controller setContent:@{@"name": @"Martin"}];
    STAssertEqualObjects([[controller selection] valueForKeyPath:@"name"], @"Martin", @"name equals 'Martin'");
    STAssertEqualObjects([[controller selection] valueForKeyPath:@"lastName"], nil, @"name equals 'nil'");
    STAssertEqualObjects([controller valueForKeyPath:@"selection.name"], @"Martin", @"selection.name equals 'Martin'");
    STAssertEqualObjects([controller valueForKeyPath:@"selection.lastName"], nil, @"selection.name equals 'nil'");
}

…Controller returns "null marker" instead of nil
@cappbot
Copy link

cappbot commented Sep 13, 2013

Milestone: Someday. Label: #new. What's next? A reviewer should examine this issue.

@ahankinson
Copy link
Contributor

For information, here is the Travis failure for this test case.

addFailure test=[CPObjectControllerTest testObjectControllerSelectionWithNil]: name equals 'nil' expected:<null> but was:<<NULL MARKER>>
Trace not implemented

-#new
+#accepted
+#needs-patch
+AppKit
+bug

@cappbot
Copy link

cappbot commented Oct 8, 2013

Milestone: Someday. Labels: #accepted, #needs-patch, AppKit, bug. What's next? This issue needs a volunteer to write and submit code to address it.

@enquora
Copy link
Contributor

enquora commented Dec 22, 2023

Is this still relevant?
Will attempt to confirm myself.
If so, unclear why this hasn't been merged long ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants