From 5bcf62d6947fe348a2b055bce633df1d12ff4370 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 30 May 2013 14:23:48 +0200 Subject: [PATCH] hda_analyzer: don't fail to display audio selector if caps variables aren't available In particular, when an audio selector node has Amp-In caps: N/A, it allows to still interact with the selector, and not have TypeError traceback throwns because of NoneType variables. Reported-by: Anisse Astier Signed-off-by: Jaroslav Kysela --- hda-analyzer/hda_guilib.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hda-analyzer/hda_guilib.py b/hda-analyzer/hda_guilib.py index 93c85e1..ffc11c9 100644 --- a/hda-analyzer/hda_guilib.py +++ b/hda-analyzer/hda_guilib.py @@ -285,9 +285,10 @@ class NodeGui(gtk.ScrolledWindow): frame.set_border_width(4) vbox = gtk.VBox(False, 0) if caps: - str = 'Offset: %d\n' % caps.ofs - str += 'Number of steps: %d\n' % caps.nsteps - str += 'Step size: %d\n' % caps.stepsize + if caps.ofs != None: + str = 'Offset: %d\n' % caps.ofs + str += 'Number of steps: %d\n' % caps.nsteps + str += 'Step size: %d\n' % caps.stepsize str += 'Mute: %s\n' % (caps.mute and "True" or "False") vbox.pack_start(self.__new_text_view(text=str), True, True, 0) idx = 0 -- 2.47.1