summaryrefslogtreecommitdiff
path: root/ext/dl
diff options
context:
space:
mode:
Diffstat (limited to 'ext/dl')
-rw-r--r--ext/dl/sym.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/dl/sym.c b/ext/dl/sym.c
index 751b2be39f..7151d3c04e 100644
--- a/ext/dl/sym.c
+++ b/ext/dl/sym.c
@@ -154,8 +154,9 @@ rb_dlsym_initialize(int argc, VALUE argv[], VALUE self)
rb_scan_args(argc, argv, "12", &addr, &name, &type);
saddr = (void*)(DLNUM2LONG(rb_Integer(addr)));
- sname = NIL_P(name) ? NULL : StringValuePtr(name);
+ if (!NIL_P(name)) StringValue(name);
stype = NIL_P(type) ? NULL : StringValuePtr(type);
+ sname = NIL_P(name) ? NULL : RSTRING(name)->ptr;
if( saddr ){
Data_Get_Struct(self, struct sym_data, data);