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

wants to merge 1 commit into

3 participants

Cappuccino 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'");

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


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



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

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