[alsa-devel] [PATCH] hda-analyzer: Avoid AttributeError when codec has no nodes

Ozan Çağlayan ozan at pardus.org.tr
Thu Feb 4 18:30:54 CET 2010


When traversing card/codec/nodes during treewidget creation, it's quite
possible that codec.nodes raises an AttributeError if the current codec
doesn't seem to have a nodes dictionary.

Simply initialize it to an empty dictionary in the beginning of
analyze().

Signed-off-by: Ozan Çağlayan <ozan at pardus.org.tr>
---
 hda-analyzer/hda_codec.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hda-analyzer/hda_codec.py b/hda-analyzer/hda_codec.py
index cbea3f8..d587a28 100644
--- a/hda-analyzer/hda_codec.py
+++ b/hda-analyzer/hda_codec.py
@@ -818,6 +818,7 @@ class HDACodec:
   def analyze(self):
     self.afg = None
     self.mfg = None
+    self.nodes = {}
     self.vendor_id = self.param_read(AC_NODE_ROOT, PARAMS['VENDOR_ID'])
     self.subsystem_id = self.param_read(AC_NODE_ROOT, PARAMS['SUBSYSTEM_ID'])
     self.revision_id = self.param_read(AC_NODE_ROOT, PARAMS['REV_ID'])
@@ -866,7 +867,6 @@ class HDACodec:
 
     nodes_count, nid = self.get_sub_nodes(self.afg)
     self.base_nid = nid
-    self.nodes = {}
     for i in range(nodes_count):
       self.nodes[nid] = HDANode(self, nid)
       nid += 1
-- 
1.6.5.6



More information about the Alsa-devel mailing list