1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

winctrls: fix warning about uninitialised variable.

Coverity points out that it's theoretically possible for the main loop
in radioline_common() to read r.bottom without having gone through the
conditional setup at the start of the function _or_ a previous
iteration of the main loop. I think this can only happen in some silly
case that doesn't actually come up, but on the other hand, it's easy
to add the necessary robustness.
This commit is contained in:
Simon Tatham 2021-04-09 17:52:49 +01:00
parent ed1d64b48a
commit 597e4731f9

View File

@ -222,13 +222,15 @@ static void radioline_common(struct ctlpos *cp, char *text, int id,
int i;
int j;
r.left = GAPBETWEEN;
r.top = cp->ypos;
if (text) {
r.left = GAPBETWEEN;
r.top = cp->ypos;
r.right = cp->width;
r.bottom = STATICHEIGHT;
cp->ypos += r.bottom + GAPWITHIN;
doctl(cp, r, "STATIC", WS_CHILD | WS_VISIBLE, 0, text, id);
} else {
r.right = r.bottom = 0;
}
group = WS_GROUP;