Check for empty strings when initializing twitch client

When setting is cleared via user its value is set to empty string and
never to null again.

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2019-03-20 14:21:31 +01:00
parent 9249129383
commit 4e47a25438

View File

@@ -24,6 +24,7 @@
*/
package net.runelite.client.plugins.twitch;
import com.google.common.base.Strings;
import com.google.inject.Provides;
import java.time.temporal.ChronoUnit;
import java.util.Map;
@@ -98,9 +99,9 @@ public class TwitchPlugin extends Plugin implements TwitchListener, ChatboxInput
private synchronized void connect()
{
if (twitchConfig.username() != null
&& twitchConfig.oauthToken() != null
&& twitchConfig.channel() != null)
if (!Strings.isNullOrEmpty(twitchConfig.username())
&& !Strings.isNullOrEmpty(twitchConfig.oauthToken())
&& !Strings.isNullOrEmpty(twitchConfig.channel()))
{
String channel = twitchConfig.channel().toLowerCase();
if (!channel.startsWith("#"))