self._mixers[0] Index out of range on start

Bug #584763 reported by foxbunny
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gmixer
New
Undecided
Unassigned

Bug Description

On Arch Linux x86_64, gmixer version 1.3, I get an IndexError exception when I try to start gmixer.

Here's the traceback.

Traceback (most recent call last):
  File "/usr/bin/gmixer", line 1168, in <module>
    GMixer(options.daemon, options.custom_mixer_cmd, options.pixmap)
  File "/usr/bin/gmixer", line 592, in __init__
    self._load_defaults()
  File "/usr/bin/gmixer", line 749, in _load_defaults
    self._current_mixer = self._mixers[0]
IndexError: list index out of range

It occurs in:

def _load_defaults(self):
        # Prefer alsamixer by default
        for mixer in self._mixers:
            if mixer.get_factory().get_name() == "alsamixer":
                self._current_mixer = mixer
                break
        else:
            self._current_mixer = self._mixers[0]

The for block is obviously wrong here, because it improperly handles the case where ``self._mixers`` is empty. There should be a test first to see if ``self._mixers`` is ``True``.

    if self._mixers:
        for mixer in self._mixers:
            if mixer.get_factory().get_name() == "alsamixer":
                self._current_mixer = mixer
                break
        else:
            self._current_mixer = self._mixers[0]
    else:
        # print a helpful error message or find an alternative way

As for the issue, I have ``alsamixer`` run just fine, so I find it odd that gmixer is not able to find any mixers at all. Why is this happening?

Revision history for this message
foxbunny (bg-branko) wrote :

I've just tried this with the bzr version (@ Mon May 24 01:38:55 CEST 2010), and the results are the same.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.