Skip to content

Runtime error during call ProgressBar.setFill() with sprite argument. #252

Description

@mdgfox

I guess the next fragment is wrong(with "if (!this.fill)") is wrong and it should be the same as in main branch.

if (this.options?.nineSlicePlane)
{
        if (typeof fill === 'string')
        {
            this.fill = new PixiNineSlicePlane(Texture.from(fill), ...this.options.nineSlicePlane.fill);
        }
        else if (fill instanceof Texture)
        {
            this.fill = new PixiNineSlicePlane(fill, ...this.options.nineSlicePlane.fill);
        }
        else
        {
            console.warn('NineSlicePlane can not be used with views set as Container.');
        }
}

if (!this.fill)
{
      this.fill = getView(fill) as Sprite | Graphics;
 }

Expected Behavior

No runtime errors.

Current Behavior

Runtime error with next stack-trace
"Cannot set properties of null (setting '_parentID')
at _Container2.addChildAt (...)
at ProgressBar.setFill (...)"

Possible Solution

I guess there is the correct way of implementation in current main branch.

Steps to Reproduce

  1. Create Progress bar
  2. Call progressBar.setFill(new Sprite("some_sprite");

Environment

  • version pixiui: e.g. 1.2.4
  • version pixijs: e.g. 7.4.2
  • Browser & Version: e.g. Chrome 144
  • OS & Version: e.g. MacOS Tahoe 26.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions