Responded privately, but I also want to give a general response in case anyone else runs into similar issues.
It does in fact appear that the problem was UrlFetchApp.fetch() was being called with an empty string. In this case, the code is assuming all ads have a destination url, which is not the case (certain ad types do not have destination urls). This can be addressed by either filtering out ads that don't have a destination url:
var ad_iter = AdWordsApp.ads().withCondition("DestinationUrl CONTAINS 'h'").get();
Or by skipping ads that don't have a destination url:
var dest_url = ad_iter.next().getDestinationUrl();
// Only fetch pages if the dest_url is not null.
if (dest_url) {
var html = UrlFetchApp.fetch(dest_url, {}).getContentText());
// do stuff with the html.
...
}
Cheers,
Alex