projects
/
ldk-java
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c8499e6
)
Correctly handle null pointers returned from Rust representing None
author
Matt Corallo
<git@bluematt.me>
Thu, 5 Aug 2021 03:18:28 +0000
(
03:18
+0000)
committer
Matt Corallo
<git@bluematt.me>
Thu, 5 Aug 2021 03:18:28 +0000
(
03:18
+0000)
java_strings.py
patch
|
blob
|
history
diff --git
a/java_strings.py
b/java_strings.py
index f6bf763d9695bef6b0ae028da82f0f0b8c77a01c..d4931cd912038295c89ab63ce11f0ffdbe9e35e7 100644
(file)
--- a/
java_strings.py
+++ b/
java_strings.py
@@
-106,7
+106,7
@@
import java.util.LinkedList;
class CommonBase {
long ptr;
LinkedList<Object> ptrs_to = new LinkedList();
class CommonBase {
long ptr;
LinkedList<Object> ptrs_to = new LinkedList();
- protected CommonBase(long ptr) { this.ptr = ptr; }
+ protected CommonBase(long ptr) {
assert ptr > 1024;
this.ptr = ptr; }
}
"""
}
"""
@@
-1226,6
+1226,9
@@
import java.util.Arrays;
else:
out_java_struct += (info.arg_name)
out_java_struct += (");\n")
else:
out_java_struct += (info.arg_name)
out_java_struct += (");\n")
+ if return_type_info.java_ty == "long" and return_type_info.java_hu_ty != "long":
+ out_java_struct += "\t\tif (ret < 1024) { return null; }\n"
+
if return_type_info.to_hu_conv is not None:
if not takes_self:
out_java_struct += ("\t\t" + return_type_info.to_hu_conv.replace("\n", "\n\t\t").replace("this",
if return_type_info.to_hu_conv is not None:
if not takes_self:
out_java_struct += ("\t\t" + return_type_info.to_hu_conv.replace("\n", "\n\t\t").replace("this",