Added error handling for empty patch URLs and text