Add null response handling

Occasionally our production app would crash due to "delete data.$" line, when "data" was null. We could not reproduce the reason why "data" would be null, and no error was ever triggered. Added a simple check to throw an error in case "data" received is null.