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

                                     (1+ column)))
                             ? ))
        (shm/init)))
     ((eq 'Lambda (shm-node-cons parent))
      (cond
       ((eq shm-lambda-indent-style 'leftmost-parent)
        (let ((leftmost-parent (cdr (shm-find-furthest-parent-on-line parent-pair))))

      (newline)
      (indent-to (+ (shm-indent-spaces) (shm-node-start-column current))))
     ;; Indentation for function application.
     ((and parent
           (eq 'App (shm-node-cons parent)))
      (let ((column
             (save-excursion
               (shm/goto-parent)
