Title: [643] trunk/activerecord-jdbc/src/java/JDBCDerbySpec.java: Fix a few NPE's
- Revision
- 643
- Author
- olabini
- Date
- 2007-06-19 08:54:56 -0400 (Tue, 19 Jun 2007)
Log Message
Fix a few NPE's
Modified Paths
Diff
Modified: trunk/activerecord-jdbc/src/java/JDBCDerbySpec.java (642 => 643)
--- trunk/activerecord-jdbc/src/java/JDBCDerbySpec.java 2007-06-19 12:12:15 UTC (rev 642)
+++ trunk/activerecord-jdbc/src/java/JDBCDerbySpec.java 2007-06-19 12:54:56 UTC (rev 643)
@@ -264,7 +264,7 @@
public static IRubyObject select_one(IRubyObject recv, IRubyObject[] args) {
IRubyObject limit = recv.getInstanceVariable("@limit");
- if(limit.isNil()) {
+ if(limit == null || limit.isNil()) {
recv.setInstanceVariable("@limit", recv.getRuntime().newFixnum(1));
}
try {
@@ -291,13 +291,13 @@
return JdbcAdapterInternalService.execute_insert(conn, args[0]);
} else if(sql.startsWith("select") || sql.startsWith("show")) {
IRubyObject offset = recv.getInstanceVariable("@offset");
- if(offset.isNil()) {
+ if(offset == null || offset.isNil()) {
offset = RubyFixnum.zero(runtime);
}
IRubyObject limit = recv.getInstanceVariable("@limit");
IRubyObject range;
IRubyObject max;
- if(limit.isNil() || RubyNumeric.fix2int(limit) == -1) {
+ if(limit == null || limit.isNil() || RubyNumeric.fix2int(limit) == -1) {
range = RubyRange.newRange(runtime, offset, runtime.newFixnum(-1), false);
max = RubyFixnum.zero(runtime);
} else {
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel