adding for loop on list to to handle the return of none when the list is empty

adding for loop on list to to handle the return of none when the list is empty. With the previous method if the list was empty the script died. See http://stackoverflow.com/questions/18852324/typeerror-sequence-item-0-expected-string-nonetype-found.

This was causing the inventory script to fail on our account until we made the change. Works good now