check number of fields before trying to add row
git-svn-id: file:///home/svn/framework3/trunk@10482 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
parent
01f8d6b4f6
commit
e646176db7
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue