From 09b2157307bcfb080f0357a8af0b9ffedaeb7af5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Wed, 22 Jan 2025 18:31:52 -0500
Subject: [PATCH] Attempt to silence false positive warning.

The warning suggests that x1 and y1 may be uninitialized in the i > 0
block, but that's not really possible...

It's too bad the warning doesn't clarify.  It's also weird that the
warning was in the draw_line() call and not in the lines above that
(incorrectly) compared them with -1.

Fix that check while we're here.
---
 src/syncterm/ripper.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/syncterm/ripper.c b/src/syncterm/ripper.c
index 78e8e76bcf..b8537333b5 100644
--- a/src/syncterm/ripper.c
+++ b/src/syncterm/ripper.c
@@ -11238,6 +11238,9 @@ do_rip_command(int level, int sublevel, int cmd, const char *rawargs)
 								break;
 							fg = map_rip_color(rip.color);
 							arg1 = parse_mega(&args[0], 2);
+							// TODO: Does this draw a point if there's a single point?
+							if (arg1 < 1)
+								break;
 							for (i = 0; i < arg1; i++) {
 								if (i == 0) {
 									x1 = parse_mega(&args[2], 2);
@@ -11261,10 +11264,10 @@ do_rip_command(int level, int sublevel, int cmd, const char *rawargs)
 							}
 							if (i > 0) {
 								x2 = parse_mega(&args[2], 2);
-								if (x1 == -1)
+								if (x2 == -1)
 									break;
 								y2 = parse_mega(&args[4], 2);
-								if (y1 == -1)
+								if (y2 == -1)
 									break;
 								draw_line(x1, y1, x2, y2, true);
 							}
-- 
GitLab