From 4b2230182c25be10e857b3290d55138b951a9f76 Mon Sep 17 00:00:00 2001 From: Tobias Schmidt <tobias.schmidt@unibas.ch> Date: Tue, 14 Aug 2012 14:57:46 +0200 Subject: [PATCH] table class: check for empty table in MaxRow/MinRow --- modules/base/pymod/table.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/base/pymod/table.py b/modules/base/pymod/table.py index 3bd8c750e..4d22196ca 100644 --- a/modules/base/pymod/table.py +++ b/modules/base/pymod/table.py @@ -1363,9 +1363,12 @@ Statistics for column %(col)s :param col: column name :type col: :class:`str` + + :returns: row with maximal col value or None if the table is empty """ val, idx = self._Max(col) - return self.rows[idx] + if idx!=None: + return self.rows[idx] def Max(self, col): """ @@ -1427,9 +1430,12 @@ Statistics for column %(col)s :param col: column name :type col: :class:`str` + + :returns: row with minimal col value or None if the table is empty """ val, idx = self._Min(col) - return self.rows[idx] + if idx!=None: + return self.rows[idx] def MinIdx(self, col): """ -- GitLab