Fixed some NPEs
This commit is contained in:
parent
ce5c337da9
commit
23fbc0824c
1 changed files with 7 additions and 2 deletions
|
@ -95,7 +95,12 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
||||||
flair = null;
|
flair = null;
|
||||||
else
|
else
|
||||||
flair = flairjson.getAsString();
|
flair = flairjson.getAsString();
|
||||||
String distinguished = data.get("distinguished").getAsString();
|
JsonElement distinguishedjson = data.get("distinguished");
|
||||||
|
String distinguished;
|
||||||
|
if (distinguishedjson.isJsonNull())
|
||||||
|
distinguished = null;
|
||||||
|
else
|
||||||
|
distinguished = distinguishedjson.getAsString();
|
||||||
String url = data.get("url").getAsString();
|
String url = data.get("url").getAsString();
|
||||||
long date = data.get("created_utc").getAsLong();
|
long date = data.get("created_utc").getAsLong();
|
||||||
if (date <= lastannouncementtime)
|
if (date <= lastannouncementtime)
|
||||||
|
@ -104,7 +109,7 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
||||||
System.out.println("title: " + title);
|
System.out.println("title: " + title);
|
||||||
System.out.println("distinguished: " + distinguished);
|
System.out.println("distinguished: " + distinguished);
|
||||||
System.out.println("url: " + url);
|
System.out.println("url: " + url);
|
||||||
if (distinguished.equals("moderator"))
|
if (distinguished != null && distinguished.equals("moderator"))
|
||||||
msgsb.append("A new mod post was submitted to the subreddit");
|
msgsb.append("A new mod post was submitted to the subreddit");
|
||||||
else
|
else
|
||||||
msgsb.append("A new post was submitted to the subreddit");
|
msgsb.append("A new post was submitted to the subreddit");
|
||||||
|
|
Loading…
Reference in a new issue