"o" is null error isolation attempt.

I've simply commented out the section of code that tests to see if there are any <ref> tags after the {{reflist}} template.  If this eliminates the error message, then that might indicate that the bug is in those 5-6 lines of code and I can track it down easier.