Skip to content

Commit d96c349

Browse files
committed
refactor: (jruby) string can not be nil here
1 parent 6c3e8a3 commit d96c349

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ext/java/org/jruby/ext/stringio/StringIO.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public Encoding getEncoding() {
149149
}
150150

151151
RubyString string = ptr.string;
152-
if (string != null && !string.isNil()) {
152+
if (string != null) {
153153
return string.getEncoding();
154154
}
155155

@@ -2210,12 +2210,13 @@ private void checkWritable() {
22102210
}
22112211

22122212
private void checkModifiable() {
2213-
if (getPtr().string == null || getPtr().string.isNil()) {
2213+
final RubyString string = getPtr().string;
2214+
if (string == null) {
22142215
/* Null device StringIO */
2215-
} else if (getPtr().string.isFrozen()) {
2216+
} else if (string.isFrozen()) {
22162217
throw getRuntime().newIOError("not modifiable string");
22172218
} else {
2218-
getPtr().string.modify();
2219+
string.modify();
22192220
}
22202221
}
22212222

0 commit comments

Comments
 (0)