Update main_adapter.rb

checking for nil and present