File tree Expand file tree Collapse file tree 4 files changed +32
-0
lines changed
Expand file tree Collapse file tree 4 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ Latest Changes:
1212
1313 - Fixed conversion of float16 for subnormal numbers.
1414
15+ - Fixed segmentation fault on null String.
16+
1517 - Fixed bugs with java.util.List concat and repeat methods.
1618
1719 - Enhancement to JProxy to handle wrapping an existing Python object with a Java
Original file line number Diff line number Diff line change @@ -1094,6 +1094,8 @@ class JPStringAccessor
10941094string JPJavaFrame::toString (jobject o)
10951095{
10961096 auto str = (jstring) CallObjectMethodA (o, getContext ()->m_Object_ToStringID , nullptr );
1097+ if (str == nullptr )
1098+ return " null" ;
10971099 return toStringUTF8 (str);
10981100}
10991101
Original file line number Diff line number Diff line change 1+ /* ****************************************************************************
2+ Licensed under the Apache License, Version 2.0 (the "License");
3+ you may not use this file except in compliance with the License.
4+ You may obtain a copy of the License at
5+
6+ http://www.apache.org/licenses/LICENSE-2.0
7+
8+ Unless required by applicable law or agreed to in writing, software
9+ distributed under the License is distributed on an "AS IS" BASIS,
10+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+ See the License for the specific language governing permissions and
12+ limitations under the License.
13+
14+ See NOTICE file for details.
15+ **************************************************************************** */
16+ package jpype .str ;
17+
18+ public class Bad
19+ {
20+ public String toString ()
21+ {
22+ return null ;
23+ }
24+ }
Original file line number Diff line number Diff line change @@ -181,3 +181,7 @@ def testSlice(self):
181181 self .assertEqual (s [:5 ], s2 [:5 ])
182182 self .assertEqual (s [3 :], s2 [3 :])
183183 self .assertEqual (s [::- 1 ], s2 [::- 1 ])
184+
185+ def testBad (self ):
186+ bad = jpype .JClass ("jpype.str.Bad" )()
187+ self .assertEqual (str (bad ), "null" )
You can’t perform that action at this time.
0 commit comments