Skip to content

Commit

Permalink
Workaround NativeThread not being able to grab a TC yet. We really wa…
Browse files Browse the repository at this point in the history
…nt something here valid as a default name even if we explicitly add nil as explicit param to constructor.
enebo committed Mar 6, 2018
1 parent cb48a21 commit b2f7fbf
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ public class NativeThread implements ThreadLike {
public NativeThread(RubyThread rubyThread, Thread nativeThread) {
this.rubyThread = rubyThread;
this.nativeThread = new WeakReference<>(nativeThread);
this.rubyName = rubyThread.getContext().nil;
this.rubyName = null;
}

public void start() {
@@ -128,7 +128,7 @@ public void setRubyName(IRubyObject name) {
@Override
@Deprecated
public String getRubyName() {
return rubyName.asJavaString();
return rubyName == null ? null : rubyName.asJavaString();
}

@Override
@@ -138,7 +138,7 @@ public String getReportName() {
Thread thread = getThread();
if (thread != null) nativeName = thread.getName();

if (rubyName.isNil() || ((RubyString) rubyName).size() == 0) {
if (rubyName == null || rubyName.isNil() || ((RubyString) rubyName).size() == 0) {
return nativeName.equals("") ? "(unnamed)" : nativeName;
}

0 comments on commit b2f7fbf

Please sign in to comment.