From e4e829b5f9ecda43c5c20f3c3fb5f7d538e2fe8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= Date: Fri, 1 Mar 2013 11:29:09 +0100 Subject: [PATCH] audio plugin: fixed error handling in _get_timeout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jaroslav Škarvada --- tuned/plugins/plugin_audio.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tuned/plugins/plugin_audio.py b/tuned/plugins/plugin_audio.py index 937f487..ad0fea6 100644 --- a/tuned/plugins/plugin_audio.py +++ b/tuned/plugins/plugin_audio.py @@ -63,11 +63,10 @@ class AudioPlugin(base.Plugin): @command_get("timeout") def _get_timeout(self, device): sys_file = self._timeout_path(device) - try: - value = tuned.utils.commands.read_file(sys_file) + value = tuned.utils.commands.read_file(sys_file) + if len(value) > 0: return int(value) - except: - return None + return None @command_custom("reset_controller", per_device=True, priority=10) def _reset_controller(self, enabling, value, device):