patch 8.2.0235: draw error when an empty group is removed from 'statusline'

Problem:    Draw error when an empty group is removed from 'statusline'.
Solution:   Do not use highlighting from a removed group.
diff --git a/src/testdir/test_statusline.vim b/src/testdir/test_statusline.vim
index 1f705b8..ebfe8aa 100644
--- a/src/testdir/test_statusline.vim
+++ b/src/testdir/test_statusline.vim
@@ -8,6 +8,7 @@
 
 source view_util.vim
 source check.vim
+source screendump.vim
 
 func s:get_statusline()
   return ScreenLines(&lines - 1, &columns)[0]
@@ -393,3 +394,22 @@
   bwipe! x1
   bwipe! x2
 endfunc
+
+func Test_statusline_removed_group()
+  CheckScreendump
+
+  let lines =<< trim END
+    scriptencoding utf-8
+    set laststatus=2
+    let &statusline = '%#StatColorHi2#%(✓%#StatColorHi2#%) Q≡'
+  END
+  call writefile(lines, 'XTest_statusline')
+
+  let buf = RunVimInTerminal('-S XTest_statusline', {'rows': 10, 'cols': 50})
+  call term_wait(buf, 100)
+  call VerifyScreenDump(buf, 'Test_statusline_1', {})
+
+  " clean up
+  call StopVimInTerminal(buf)
+  call delete('XTest_statusline')
+endfunc