- const figcaption = document.createElement('figcaption');
- const caption_text = document.createTextNode(`${image.prompt} (${image.code}) `);
- figcaption.appendChild(caption_text);
+ if (image.prompt && image.code) {
+ const figcaption = document.createElement('figcaption');
+ const caption_text = document.createTextNode(`${image.prompt} (${image.code}) `);
+ figcaption.appendChild(caption_text);