Skip to content

Commit

Permalink
Throw an exception when calling the removeObserver:forKeyPath:context…
Browse files Browse the repository at this point in the history
…: method
  • Loading branch information
gcasa committed Sep 14, 2023
1 parent 5507ea1 commit b8bc924
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Source/NSKeyValueObserving.m
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,9 @@ - (void) removeObserver: (NSObject*)anObserver
forKeyPath: (NSString*)aPath
context: (void*)context
{
[self removeObserver: anObserver forKeyPath: aPath];
[NSException raise: NSGenericException
format: @"[%@-%@]: This class is not observable",
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
}

@end
Expand Down

0 comments on commit b8bc924

Please sign in to comment.