lib/ffi/libfuse/fuse_context.rb in ffi-libfuse-0.4.0 vs lib/ffi/libfuse/fuse_context.rb in ffi-libfuse-0.4.1

- old
+ new

@@ -13,10 +13,11 @@ include FFI::Accessors base = { fuse: :fuse, uid: :uid_t, gid: :gid_t, pid: :pid_t, private_data: RubyObject } base[:umask] = :mode_t if FUSE_VERSION >= 28 layout base - ffi_attr_reader(*members, simple: false) do + # Define readers, safe from null access + ffi_attr_reader_method(*members) do m = __method__ # Use overrides if they are available, or the default context if the underlying memory is invalid FuseContext.overrides[m] || (null? ? DEFAULT_CONTEXT[m] : self[m]) end