Skip to content

Commit e45c2b2

Browse files
committed
Don’t try to embed user avatar if no avatar is uploaded
1 parent 45a98e2 commit e45c2b2

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

library.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,14 @@
7676
var maxQuoteLength = plugin.config['maxLength'] || 1024;
7777
if (content.length > maxQuoteLength) { content = content.substring(0, maxQuoteLength) + '...'; }
7878

79-
// Ensure absolute thumbnail URL:
80-
var thumbnail = data.user.picture.match(/^\//) ? forumURL + data.user.picture : data.user.picture;
79+
// Ensure absolute thumbnail URL if an avatar exists:
80+
var thumbnail = null;
81+
82+
if (data.user.picture && data.user.picture.match(/^\//)) {
83+
thumbnail = forumURL + data.user.picture;
84+
} else if (data.user.picture) {
85+
thumbnail = data.user.picture;
86+
}
8187

8288
// Add custom message:
8389
var messageContent = plugin.config['messageContent'] || '';

0 commit comments

Comments
 (0)