Skip to content

Commit

Permalink
Fixed #28
Browse files Browse the repository at this point in the history
  • Loading branch information
replaceitem committed May 3, 2022
1 parent 8e39af9 commit cc07a12
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ public void apply(EmbedBuilder embedBuilder) {
embedBuilder.setAuthor(name,url,image);
return;
}
String iconString = icon.getString();
File file = new File(iconString);
if(file.exists()) {
embedBuilder.setAuthor(name, url, file);
return;
String iconString = icon == null? null : icon.getString();
if(iconString != null) {
File file = new File(iconString);
if(file.exists()) {
embedBuilder.setAuthor(name, url, file);
return;
}
}
embedBuilder.setAuthor(name, url, iconString);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ public void apply(EmbedBuilder embedBuilder) {
embedBuilder.setFooter(text,image);
return;
}
String iconString = icon.getString();
File file = new File(iconString);
if(file.exists()) {
embedBuilder.setFooter(text, file);
return;
String iconString = icon == null? null : icon.getString();
if(iconString != null) {
File file = new File(iconString);
if (file.exists()) {
embedBuilder.setFooter(text, file);
return;
}
}
embedBuilder.setFooter(text, iconString);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ public class WebhookMessageProfileParsable implements Applicable<WebhookMessageB
@Override
public void apply(WebhookMessageBuilder webhookMessageBuilder) {
webhookMessageBuilder.setDisplayName(name);
try {
webhookMessageBuilder.setDisplayAvatar(new URL(avatar));
} catch (MalformedURLException e) {
throw new InternalExpressionException("Invalid avatar URL: " + e);
if(avatar != null) {
try {
webhookMessageBuilder.setDisplayAvatar(new URL(avatar));
} catch (MalformedURLException e) {
throw new InternalExpressionException("Invalid avatar URL: " + e);
}
}
}
}

0 comments on commit cc07a12

Please sign in to comment.