lib/spotify.rb in spotify-10.0.0 vs lib/spotify.rb in spotify-10.0.1
- old
+ new
@@ -531,10 +531,15 @@
# Redefined, as the layout of the Struct can only be determined
# at run-time.
#
# @param [FFI::Pointer] pointer
def initialize(pointer)
- super(pointer, :count, :uint, :subscribers, [:pointer, pointer.read_uint])
+ count = pointer.read_uint
+
+ layout = [:count, :uint]
+ layout += [:subscribers, [:pointer, count]] if count > 0
+
+ super(pointer, *layout)
end
end
#
enum :playlist_type, [:playlist, :start_folder, :end_folder, :placeholder]