-[CPArrayController setContent:] would interpret nil as [nil].

When initializing a CPArrayController with a value that is not an array setContent: would make it an array by replacing value with [value]. This is consistent with how Cocoa does it, but it should first check to make sure that the content is not nil. If it is, the sensible thing to do (and what Cocoa does) is to replace it with an empty array.

This commit also includes a missing import to make CPArrayControllerTest run without error.
This commit is contained in:
Brian Donovan authored and Francisco Ryan Tolmasky I committed 2010-11-03 01:24:38 -07:00
1 parent 99c1d18d95
commit 7bf2297125
3 files changed
+10

No files matched your search

+3
View File
@@ -150,6 +150,9 @@
- (void)setContent:(id)value
{
if (value == nil)
value = [];
if (![value isKindOfClass:[CPArray class]])
value = [value];