Skip to content

Commit faaaca4

Browse files
committedApr 2, 2024·
Fix second uncaught exception
1 parent 8f5590c commit faaaca4

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed
 

‎native/common/jp_exception.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ void JPypeException::convertJavaToPython()
220220
PyJPException_normalize(frame, prev, jcause, th);
221221
PyException_SetCause(cause.get(), prev.keep());
222222
}
223-
PyException_SetTraceback(cause.get(), trace.get());
223+
if (trace.get() != nullptr)
224+
PyException_SetTraceback(cause.get(), trace.get());
224225
PyException_SetCause(pyvalue.get(), cause.keep());
225226
} catch (JPypeException& ex)
226227
{

‎native/python/pyjp_object.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ void PyJPException_normalize(JPJavaFrame frame, JPPyObject exc, jthrowable th, j
390390
{
391391
// Attach the frame to first
392392
JPPyObject trace = PyTrace_FromJavaException(frame, th, enclosing);
393-
if (trace.get()!=nullptr)
393+
if (trace.get() != nullptr)
394394
PyException_SetTraceback(exc.get(), trace.get());
395395

396396
// Check for the next in the cause list

0 commit comments

Comments
 (0)
Please sign in to comment.