Skip to content

Commit 529c30f

Browse files
committed
Fix issue #181 (should validate cfInode)
1 parent 998c16e commit 529c30f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/efsw/FileWatcherFSEvents.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,13 @@ void FileWatcherFSEvents::FSEventCallback( ConstFSEventStreamRef streamRef, void
8484
CFDictionaryGetValue( pathInfoDict, kFSEventStreamEventExtendedDataPathKey ) );
8585
CFNumberRef cfInode = static_cast<CFNumberRef>(
8686
CFDictionaryGetValue( pathInfoDict, kFSEventStreamEventExtendedFileIDKey ) );
87-
unsigned long inode = 0;
88-
CFNumberGetValue( cfInode, kCFNumberLongType, &inode );
89-
events.push_back( FSEvent( convertCFStringToStdString( path ), (long)eventFlags[i],
90-
(Uint64)eventIds[i], inode ) );
87+
88+
if ( cfInode ) {
89+
unsigned long inode = 0;
90+
CFNumberGetValue( cfInode, kCFNumberLongType, &inode );
91+
events.push_back( FSEvent( convertCFStringToStdString( path ), (long)eventFlags[i],
92+
(Uint64)eventIds[i], inode ) );
93+
}
9194
} else {
9295
events.push_back( FSEvent( std::string( ( (char**)eventPaths )[i] ),
9396
(long)eventFlags[i], (Uint64)eventIds[i] ) );

0 commit comments

Comments
 (0)