From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
Date: Fri Apr 23 22:31:27 2021 +0200
Bug: https://sourceforge.net/p/mcj/tickets/114/
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/fig2dev/+bug/1926673
Applied-Upstream: https://sourceforge.net/p/mcj/fig2dev/ci/43cfa693284b076e5d2cc100758a34b76db65e58/
Subject: Remove arrows from polygon with single point, ticket #114
 When sanitizing line objects, a polygon consisting of too few points is
 converted to a polyline. With this commit, the resulting polyline is
 also sanitized, e.g, by removing arrow tips if the line consists only of
 a single point.

--- a/fig2dev/read.c
+++ b/fig2dev/read.c
@@ -3,7 +3,7 @@
  * Copyright (c) 1991 by Micah Beck
  * Parts Copyright (c) 1985-1988 by Supoj Sutanthavibul
  * Parts Copyright (c) 1989-2015 by Brian V. Smith
- * Parts Copyright (c) 2015-2020 by Thomas Loimer
+ * Parts Copyright (c) 2015-2021 by Thomas Loimer
  *
  * Any party obtaining a copy of these files is granted, free of charge, a
  * full and unrestricted irrevocable, world-wide, paid up, royalty-free,
@@ -936,6 +936,7 @@ sanitize_lineobject(
 			put_msg("A polygon with %d points at line %d - convert to a polyline.",
 			npts, line_no);
 			l->type = T_POLYLINE;
+			sanitize_lineobject(l, p, line_no);
 			return 0;
 		}
 	}
--- a/fig2dev/tests/read.at
+++ b/fig2dev/tests/read.at
@@ -2,7 +2,7 @@ dnl Fig2dev: Translate Fig code to vario
 dnl Copyright (c) 1991 by Micah Beck
 dnl Parts Copyright (c) 1985-1988 by Supoj Sutanthavibul
 dnl Parts Copyright (c) 1989-2015 by Brian V. Smith
-dnl Parts Copyright (c) 2015-2020 by Thomas Loimer
+dnl Parts Copyright (c) 2015-2021 by Thomas Loimer
 dnl
 dnl Any party obtaining a copy of these files is granted, free of charge, a
 dnl full and unrestricted irrevocable, world-wide, paid up, royalty-free,
@@ -121,7 +121,7 @@ EOF
 ])
 AT_CLEANUP
 
-AT_SETUP([remove arrows tips from single point])
+AT_SETUP([remove arrow tips from single point])
 AT_KEYWORDS(read.c polyline)
 AT_CHECK([fig2dev -L pict2e <<EOF
 FIG_FILE_TOP
@@ -134,6 +134,19 @@ EOF
 A single point with a backward arrow - remove the arrow.
 ])
 AT_CLEANUP
+
+AT_SETUP([remove arrow tips on polygon with single point])
+AT_KEYWORDS(read.c polygon)
+AT_CHECK([fig2dev -L svg <<EOF
+FIG_FILE_TOP
+2 3 0 1 -1 -1 50 -1 -1 0. 0 0 0 0 1 1
+	0 0 2. 120. 240.
+	0 0
+EOF
+],0,ignore,[A polygon with 1 points at line 12 - convert to a polyline.
+A single point with a backward arrow - remove the arrow.
+])
+AT_CLEANUP
 
 AT_SETUP([reject huge arrow-type, ticket #57])
 AT_KEYWORDS(arrow.c arrow)
