From e646176db74e44e7672f1a013b0dfb23944aafaa Mon Sep 17 00:00:00 2001 From: Joshua Drake Date: Sun, 26 Sep 2010 04:16:18 +0000 Subject: [PATCH] check number of fields before trying to add row git-svn-id: file:///home/svn/framework3/trunk@10482 4d416f70-5f16-0410-b530-b9f4589650da --- lib/rex/ui/text/table.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/rex/ui/text/table.rb b/lib/rex/ui/text/table.rb index 108cafb9c2..ef93baf134 100644 --- a/lib/rex/ui/text/table.rb +++ b/lib/rex/ui/text/table.rb @@ -139,6 +139,9 @@ class Table # Adds a row with the supplied fields. # def add_row(fields = []) + if fields.length != self.columns.length + raise RuntimeError, 'Invalid number of columns!' + end fields.each_with_index { |field, idx| if (colprops[idx]['MaxWidth'] < field.to_s.length) colprops[idx]['MaxWidth'] = field.to_s.length