 						candidateHooksInvoked = {}
 						
 						# Insert and compile the template HTML if it exists.
-						if skinAssets.templates[candidate]
+						if skinAssets?.templates?[candidate]
 						
 							# Insert and compile HTML.
 							element.html skinAssets.templates[candidate]

				
				recalculateCandidate = ->
				
					# Track changes to the current template candidate.
					oldCandidate = candidate
					

			# compilation step.
			link = directive.link
			directive.link = (scope, element, attrs, controller) ->
				
				# Save top-level arguments for later calls to link functions.
				topLevelArgs = arguments
				
