Skip to content

fails loading, if a pack has zero stickers  #64

@LuckyTurtleDev

Description

@LuckyTurtleDev

Stickerpicker fails loading, if a pack has zero stickers:

Uncaught (in promise) TypeError: pack.stickers[0] is undefined
    NavBarItem https://ptphoenix.github.io/stickerpicker/web/src/index.js:339
    Preact 16
    _loadPacks https://ptphoenix.github.io/stickerpicker/web/src/index.js:179
    _loadPacks https://ptphoenix.github.io/stickerpicker/web/src/index.js:157
    componentDidMount https://ptphoenix.github.io/stickerpicker/web/src/index.js:190
    Preact 4
    <anonymous> https://ptphoenix.github.io/stickerpicker/web/src/index.js:363
index.js:339:1
<img src=${makeThumbnailURL(pack.stickers[0].url)}
					alt=${pack.stickers[0].body} class="visible" />

This caused also that the picker stop loading the remain packs.

I would recommend using the java script version of:

pack.stickers.first().unwrap_or("not_found.png")

However assuming that a pack is not empty is justify, but it should not effect the other stickerpacks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions