Skip to content

Commit fa5c7e2

Browse files
committed
Fix NullPointer exception in handshake
1 parent 52db45d commit fa5c7e2

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/main/java/de/jcm/discordgamesdk/Core.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public static final DiscordChannel getDiscordChannel() throws IOException
6060
}
6161
}
6262

63-
private final DiscordChannel channel;
63+
private DiscordChannel channel;
6464
private ConnectionState state;
6565
private final Gson gson;
6666
private long nonce;
@@ -116,22 +116,19 @@ public Core(CreateParams params)
116116
this.events = new Events(corePrivate);
117117
this.eventAdapter = createParams.eventAdapter;
118118

119-
DiscordChannel tempChannel;
120119
try
121120
{
122-
tempChannel = Core.getDiscordChannel();
121+
this.channel = Core.getDiscordChannel();
123122
this.sendHandshake();
124123
runCallbacks();
125-
tempChannel.configureBlocking(false);
124+
this.channel.configureBlocking(false);
126125
}
127126
catch(IOException e)
128127
{
129128
if(!suppressExceptions) {
130129
throw new RuntimeException(e);
131130
}
132-
tempChannel = null;
133131
}
134-
this.channel = tempChannel;
135132

136133
this.activityManager = new ActivityManager(corePrivate);
137134
this.applicationManager = new ApplicationManager(corePrivate);

0 commit comments

Comments
 (0)