mirror of
https://github.com/netbirdio/gomobile-tvos-fork.git
synced 2026-05-22 18:43:29 -07:00
bind: accept null objects as nil pointers
Currently the generated bindings assume that any object passed to Go as a method argument is actually a valid one originating from Go. The `null` object is however a corner case to this assumption, which should be accepted for Go pointer types, since they can cleanly convert into `nil`. This CL modifies the generated wrapper code so any `nil` reference is permitted for Go pointer types, which until now produced a nil pointer dereference error. Fixes golang/go#20330 Change-Id: If1ab9cf9df7ac3808486d23ccf2db8d32fb89426 Reviewed-on: https://go-review.googlesource.com/43253 Reviewed-by: Elias Naur <elias.naur@gmail.com>
This commit is contained in:
committed by
Elias Naur
parent
0f3174026e
commit
44a54e9b78
@@ -448,8 +448,11 @@ public class SeqTest extends InstrumentationTestCase {
|
||||
return null;
|
||||
}
|
||||
}));
|
||||
assertEquals("Go nil interface is null", null, Testpkg.newNullInterface());
|
||||
assertEquals("Go nil struct pointer is null", null, Testpkg.newNullStruct());
|
||||
assertEquals("Go nil interface is null", null, Testpkg.newNullInterface());
|
||||
assertEquals("Go nil struct pointer is null", null, Testpkg.newNullStruct());
|
||||
|
||||
Issue20330 nullArger = new Issue20330();
|
||||
assertTrue(nullArger.callWithNull(null));
|
||||
}
|
||||
|
||||
public void testPassByteArray() {
|
||||
|
||||
Reference in New Issue
Block a user