diff --git a/admin/media.php b/admin/media.php index 7c9f1570..399127df 100644 --- a/admin/media.php +++ b/admin/media.php @@ -83,8 +83,11 @@ $(document).ready(function() { } function fileUploadComplete (id, url, data) { - var img = $('.typecho-attachment-photo').get(0); - img.src = 'attachment->url(); ?>?' + Math.random(); + var img = $('.typecho-attachment-photo'); + + if (img.length > 0) { + img.get(0).src = 'attachment->url(); ?>?' + Math.random(); + } $('#' + id).html(''.replace('%s', data.title)) .effect('highlight', 1000, function () {