Skip to content

Commit 47b47a1

Browse files
authored
Null check is not needed with instanceof
instanceof will not return true for null.
1 parent ebefdf3 commit 47b47a1

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

core/src/main/java/org/jruby/ext/bigdecimal/RubyBigDecimal.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,7 +1268,7 @@ private IRubyObject addInternal(ThreadContext context, RubyBigDecimal val, IRuby
12681268
// return callCoerced(context, op, b, true); -- this is MRI behavior.
12691269
// We'll use ours for now, thus providing an ability to add Floats.
12701270
IRubyObject ret = callCoerced(context, sites(context).op_plus, b, true);
1271-
if (ret != null && ret instanceof RubyBigDecimal bd) {
1271+
if (ret instanceof RubyBigDecimal bd) {
12721272
bd.setResult(context, prec);
12731273
}
12741274
return ret;
@@ -1335,7 +1335,7 @@ public IRubyObject sub2(ThreadContext context, IRubyObject b, IRubyObject n) {
13351335
private IRubyObject subInternal(ThreadContext context, RubyBigDecimal val, IRubyObject b, int prec) {
13361336
if (val == null) {
13371337
IRubyObject ret = callCoerced(context, sites(context).op_minus, b, true);
1338-
if (ret != null && ret instanceof RubyBigDecimal bd) {
1338+
if (ret instanceof RubyBigDecimal bd) {
13391339
bd.setResult(context, prec);
13401340
}
13411341
return ret;

0 commit comments

Comments
 (0)