NPE on Thread.join() possible fix

This bug is hard to decipher mainly due to the thread being terminated somewhere before the thread.join is called. this may be due to the safeClose method defined with serverSocket, but again, I'm not too sure what's up here. This may also be because something failed to execute in one of the try catch statements, causing the thread to never be initialized in the first place.
This commit is contained in:
Paldiu 2021-01-08 00:25:46 -06:00
parent fbf2972006
commit 3464a33678

View File

@ -251,7 +251,8 @@ public abstract class NanoHTTPD
try
{
safeClose(myServerSocket);
myThread.join();
//This should prevent a null pointer :)
if (myThread != null) myThread.join();
}
catch (Exception e)
{