devdraw: fix dangling else

Because of a dangling else, after adding a name to an image with 'N',
it was immediately deleted, resulting in Enoname in response to 'n'.

This went mostly unnoticed, since plan9port itself does not use named
images, but it can break external applications like truedraw[1].

[1]: https://git.sr.ht/~arusekk/truedraw

Fixes: c66b52501b ("new draw server")
This commit is contained in:
Arusekk 2025-10-09 08:48:35 +02:00 committed by Dan Cross
parent 80b7829854
commit 00754b35a2
1 changed files with 2 additions and 2 deletions

View File

@ -1107,10 +1107,10 @@ draw_datawrite(Client *client, void *v, int n)
goto Enodrawimage;
if(di->name)
goto Enamed;
if(c)
if(c){
if(drawaddname(client, di, j, (char*)a+7, &err) < 0)
goto error;
else{
}else{
dn = drawlookupname(client, j, (char*)a+7);
if(dn == nil)
goto Enoname;