File tree 2 files changed +14
-1
lines changed
src/darwin/Framework/CHIP
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -295,6 +295,15 @@ - (instancetype)initForSubclassesWithNodeID:(NSNumber *)nodeID controller:(MTRDe
295
295
return self;
296
296
}
297
297
298
+ // For now, implement an initWithNodeID in case some sub-class outside the
299
+ // framework called it (by manually declaring it, even though it's not public
300
+ // API). Ideally we would not have this thing, since its signature does not
301
+ // match the initWithNodeID signatures of our subclasses.
302
+ - (instancetype )initWithNodeID : (NSNumber *)nodeID controller : (MTRDeviceController *)controller
303
+ {
304
+ return [self initForSubclassesWithNodeID: nodeID controller: controller];
305
+ }
306
+
298
307
- (void )dealloc
299
308
{
300
309
[[NSNotificationCenter defaultCenter ] removeObserver: _systemTimeChangeObserverToken];
Original file line number Diff line number Diff line change @@ -418,7 +418,11 @@ - (MTRBaseDevice *)baseDeviceForNodeID:(NSNumber *)nodeID
418
418
- (MTRDevice *)_setupDeviceForNodeID : (NSNumber *)nodeID prefetchedClusterData : (NSDictionary <MTRClusterPath *, MTRDeviceClusterData *> *)prefetchedClusterData
419
419
{
420
420
MTR_ABSTRACT_METHOD ();
421
- return nil ;
421
+ // We promise to not return nil from this API... return an MTRDevice
422
+ // instance, which will largely not be able to do anything useful. This
423
+ // only matters when someone subclasses MTRDeviceController in a weird way,
424
+ // then tries to create an MTRDevice from their subclass.
425
+ return [[MTRDevice alloc ] initForSubclassesWithNodeID: nodeID controller: self ];
422
426
}
423
427
424
428
- (MTRDevice *)deviceForNodeID : (NSNumber *)nodeID
You can’t perform that action at this time.
0 commit comments