Skip to content

[DEV BUG] Small issue in playlist next preset / shuffle mode #918

@yoyofr

Description

@yoyofr

Please confirm the following points:

  • This report is NOT about the Android apps in the Play Store
  • I have searched the project page to check if the issue was already reported

Affected Project

libprojectM (including the playlist library)

Affected Version

4.1.4

Operating Systems and Architectures

All

Build Tools

No response

Additional Project, OS and Toolset Details

Hi,
I've noticed a small issue in Playlist.cpp, in
auto Playlist::NextPresetIndex() -> uint32_t
When shuffle mode is active, the position can be defined beyond the last item as randomDistribution determines a number between the min & max value, inclusive of them.
So instead of
std::uniform_int_distribution<uint32_t> randomDistribution(0, static_cast<uint32_t>(m_items.size()));
I think it should rather be
std::uniform_int_distribution<uint32_t> randomDistribution(0, static_cast<uint32_t>(m_items.size()-1));

Type of Defect

Specific bug in projectM code (please link the code in question)

Log Output

Describe the Issue

when randomDistribution determines a too high position, the call to projectm_playlist_play_next wont do anything.

Metadata

Metadata

Assignees

Labels

bugThe issue is (potentially) a bug.importantImportant bugs or features which should be fixed/implemented ASAP.

Type

Projects

Status

In Review

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions