'Crossref Lookup' script fails when items returned from Crossref do not have titles

Crossref sometimes returns items that do not have the title field, and thus the ‘Crossref Lookup’ script fails. Considering wrapping the result parsing code with a try block:

	repeat with a from 1 to length of theItems
		set currentItem to item a of theItems
			set titleList to title of currentItem
			set title to item 1 of titleList
			set dateString to my extractDate(currentItem)
			set detailString to my extractAuthor(currentItem)
			if not detailString is equal to "" then
				set detailString to detailString & ", "
			end if
			set detailString to detailString & dateString
			set theChoice to title & " (" & detailString & ")"
			set end of theChoices to theChoice
		end try
	end repeat

Failure case:

# curl 'https://api.crossref.org/works?query.bibliographic=Lotse%3A%20A%20Practical%20Framework%20for%20Guidance%20in%20Visual%20Analytics&rows=5&select=author,title,type,publisher,issued,subject,URL' -vL | jq '.message.items[] | select(.type == "grant")'
  "type": "grant",
  "publisher": "Wiener Wissenschafts-, Forschungs- und Technologiefonds (WWTF)",
  "issued": {
    "date-parts": [
  "URL": "http://dx.doi.org/10.47379/ict19047"

In JavaScript, you’d do something like

items.filter(i => i.title && i.title.length > 0).forEach(i => {
  const title = i.title[0];
  const dateString = extractDate(i);

Having a try block just to catch a condition that can be handled by an if looks funny to me. But maybe that’s how it is done in AppleScript.

There might be problems for other steps since this item does not appear to have a proper date…