Add nil check for SQL result object

This is the fix I found that worked for the following issue:

https://github.com/MiniProfiler/rack-mini-profiler/issues/48