Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Let other function calls panic too

  • Loading branch information...
commit 4916cfb1a3ab36d3ed62144b1f144f063ec024b0 1 parent 2caf7a1
@manveru authored
Showing with 13 additions and 4 deletions.
  1. +13 −4 lib/ffi-tk/ffi/tcl/eval_result.rb
View
17 lib/ffi-tk/ffi/tcl/eval_result.rb
@@ -80,18 +80,27 @@ def self.map_list_core(interp, obj, &block)
def self.to_boolean(interp, obj)
boolean_pointer = MemoryPointer.new(:int)
- Tcl.get_boolean_from_obj(interp, obj, boolean_pointer)
- boolean_pointer.get_int(0) == 1
+
+ if Tcl.get_boolean_from_obj(interp, obj, boolean_pointer) == 0
+ boolean_pointer.get_int(0) == 1
+ else
+ panic(interp, 'Tcl_GetBooleanFromObj')
+ end
end
def self.to_int(interp, obj)
int_pointer = MemoryPointer.new(:int)
- Tcl.get_int_from_obj(interp, obj, int_pointer)
- int_pointer.get_int(0)
+
+ if Tcl.get_int_from_obj(interp, obj, int_pointer) == 0
+ int_pointer.get_int(0)
+ else
+ panic(interp, 'Tcl_GetIntFromObj')
+ end
end
def self.to_string(interp, obj)
length_pointer = MemoryPointer.new(:int)
+
string = Tcl.get_string_from_obj(obj, length_pointer)
string.force_encoding(Encoding.default_external)
end
Please sign in to comment.
Something went wrong with that request. Please try again.