HaxeFlixel / HaxeFlixel/flixel

Call onComplete if _sound is null

Open
#3,614 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haxe
Stars
2.2k
Forks
522
Avg merge
34m
Merged PRs (30d)
1

Description

If _sound is null then return is simply called

function startSound(st:Float):Void {
	if (_sound == null) return;

	_time = st;
	_paused = false;
	_channel = _sound.play(_time, 0, _transform);

	if(_channel != null) {
		pitch = _pitch;
		_channel.addEventListener(Event.SOUND_COMPLETE, stopped);
		active = true;
	} else exists = active = false;
}

Because of this some necessary functions aren't called
I suggest just calling these functions and I think it will be enough

if (_sound == null) {
	if (onComplete != null) onComplete();
	cleanup(autoDestroy);
	return;
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the startSound(st:Float) function and trace how onComplete and cleanup(autoDestroy) are normally invoked. Verify the null-_sound path invokes both before returning, and check the related sound behavior to confirm completion and cleanup occur as expected.

Written by the indexing model from the issue text.

Assessment

Domain
game-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.