8000 guard references · libvips/ruby-vips@257bcdb · GitHub
[go: up one dir, main page]

Skip to content

Commit 257bcdb

Browse files
committed
guard references
1 parent e29e2b6 commit 257bcdb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/vips/image.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,14 +458,14 @@ def self.new_from_source source, option_string, **opts
458458
loader = Vips.vips_foreign_find_load_source source
459459
raise Vips::Error if loader.nil?
460460

461-
image = Vips::Operation.call loader, [source], opts, option_string
461+
result = Vips::Operation.call loader, [source], opts, option_string
462462

463463
# keep a secret ref to the source object ... the libvips loader will
464464
# keep a ref to the C source object, but we need the ruby wrapper object
465465
# to stay alive too
466-
image.references << source
466+
result.references << source if result.is_a?(Vips::Image)
467467

468-
image
468+
result
469469
end
470470

471471
def self.matrix_from_array width, height, array

0 commit comments

Comments
 (0)
0