lib/ProMotion/table/data/table_data.rb in ProMotion-2.5.0.beta1 vs lib/ProMotion/table/data/table_data.rb in ProMotion-2.5.0
- old
+ new
@@ -5,10 +5,21 @@
attr_accessor :data, :filtered_data, :search_string, :original_search_string, :filtered, :table_view, :search_params
def initialize(data, table_view, search_action = nil)
@search_action ||= search_action
- self.data = data
+
+ if data.include?(nil)
+ mp("Warning: You have a `nil` section in your table_data method.", force_color: :yellow)
+ end
+
+ self.data = data.compact.each_with_index.map do |section,index|
+ if section[:cells].include?(nil)
+ mp("Warning: You have a `nil` cell in table section #{index}.", force_color: :yellow)
+ section[:cells].compact!
+ end
+ section
+ end
self.table_view = WeakRef.new(table_view)
end
def section(index)
sections.at(index) || { cells: [] }