     (cond
      ;; When inside a list, indent to the list's position with an
      ;; auto-inserted comma.
-     ((eq 'List (shm-node-cons parent))
+     ((and parent
+           (eq 'List (shm-node-cons parent)))
       (newline)
       (indent-to (shm-node-start-column parent))
       (insert ",")

      (indent-to (shm-node-start-column current))
      (insert "| "))
     ;; Indent after or at the = (an rhs).
     ((or (string= "Rhs" (shm-node-type-name parent))
          (string= "Rhs" (shm-node-type-name current))
          (string= "GuardedAlt" (shm-node-type-name parent)))
      (newline)
      (indent-to (+ (shm-indent-spaces)
                    (shm-node-start-column (cdr (shm-node-parent parent-pair))))))
     ;; When in a field update.
     ((string= "FieldUpdate" (shm-node-type-name parent))
      (newline)
      (indent-to (+ (shm-node-start-column parent)
                    (shm-indent-spaces))))
     ;; When in an alt list
     ((string= "GuardedAlts" (shm-node-type-name current))
      (newline)
      (indent-to (+ (shm-node-start-column parent)
                    (shm-indent-spaces))))
     ;; When in a case alt.
     ((string= "GuardedAlts" (shm-node-type-name parent))
      (newline)
      (let ((alt (cdr (shm-node-parent parent-pair))))
        (indent-to (+ (shm-node-start-column alt)
                      (shm-indent-spaces)))))
     ;; Copy infix operators similar to making new list/tuple
     ;; separators
     ((eq 'InfixApp (shm-node-cons parent))
      (let* ((operand-pair (shm-node-previous current-pair))
             (operand (cdr operand-pair))
             (string (buffer-substring-no-properties (shm-node-start operand)

          (newline)
          (indent-to column)))))
     ;; Indent for sum types
     ((and parent
           (eq 'DataDecl (shm-node-cons parent)))
      (newline)
      (indent-to (shm-node-start-column current))
      (delete-char -2)
