test-stringlist: avoid buffer underrun when sorting nothing
authorRené Scharfe <l.s.r@web.de>
Tue, 3 Oct 2017 14:36:40 +0000 (16:36 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 4 Oct 2017 04:41:49 +0000 (13:41 +0900)
commit97487ea11a2c68934927e515616c133e543a72ce
treed10311cf0a99e338d4a43f8bd67e524fc81ee148
parent83fc4d64fec779d73b18494461613ef911236daf
test-stringlist: avoid buffer underrun when sorting nothing

Check if the strbuf containing data to sort is empty before attempting
to trim a trailing newline character.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/helper/test-string-list.c