Skip to content

Commit

Permalink
Merge pull request #1287 from jcbertin/fix-nullability-violations
Browse files Browse the repository at this point in the history
Fix nullability violations
  • Loading branch information
ffried committed Feb 16, 2022
2 parents 3c5a743 + b248832 commit 7592cbb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Configs/Module-Debug.xcconfig
Expand Up @@ -23,6 +23,9 @@ ENABLE_NS_ASSERTIONS = YES
// When this setting is activated, the product will be built with options appropriate for running automated tests, such as making private interfaces accessible to the tests.
ENABLE_TESTABILITY = YES

// Check for violations of nullability annotations in function calls, return statements, and assignments.
CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES

// Specifies the degree to which the generated code is optimized for speed and binary size.
GCC_OPTIMIZATION_LEVEL = 0

Expand Down
6 changes: 5 additions & 1 deletion Sources/CocoaLumberjack/DDFileLogger.m
Expand Up @@ -1081,6 +1081,9 @@ - (DDLogFileInfo *)lt_currentLogFileInfo {
@"Invalid log file manager! Responds neither to `-createNewLogFileWithError:` nor `-createNewLogFile`!");
currentLogFilePath = [_logFileManager createNewLogFile];
#pragma clang diagnostic pop
if (!currentLogFilePath) {
NSLogError(@"DDFileLogger: Failed to create new log file");
}
}
// Use static factory method here, since it checks for nil (and is unavailable to Swift).
_currentLogFileInfo = [DDLogFileInfo logFileWithPath:currentLogFilePath];
Expand Down Expand Up @@ -1325,6 +1328,8 @@ - (void)lt_logData:(NSData *)data {
}

@try {
NSFileHandle *handle = [self lt_currentLogFileHandle];

if (implementsDeprecatedWillLog) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
Expand All @@ -1334,7 +1339,6 @@ - (void)lt_logData:(NSData *)data {
[self willLogMessage:_currentLogFileInfo];
}

NSFileHandle *handle = [self lt_currentLogFileHandle];
if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)) {
__autoreleasing NSError *error = nil;
BOOL success = [handle seekToEndReturningOffset:nil error:&error];
Expand Down

0 comments on commit 7592cbb

Please sign in to comment.