[tabbed] don't explode when destroying 0 tabs

dankamongmen/libsixel
nick black 4 years ago
parent 37a12e4273
commit e0c3f4dd82
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -365,13 +365,13 @@ nctab* nctabbed_select(nctabbed* nt, nctab* t){
void nctabbed_channels(nctabbed* nt, uint64_t* RESTRICT hdrchan, void nctabbed_channels(nctabbed* nt, uint64_t* RESTRICT hdrchan,
uint64_t* RESTRICT selchan, uint64_t* RESTRICT sepchan){ uint64_t* RESTRICT selchan, uint64_t* RESTRICT sepchan){
if(hdrchan){ if(hdrchan){
memcpy(&nt->opts.hdrchan, hdrchan, sizeof(*hdrchan)); memcpy(hdrchan, &nt->opts.hdrchan, sizeof(*hdrchan));
} }
if(selchan){ if(selchan){
memcpy(&nt->opts.selchan, selchan, sizeof(*selchan)); memcpy(selchan, &nt->opts.selchan, sizeof(*selchan));
} }
if(sepchan){ if(sepchan){
memcpy(&nt->opts.sepchan, sepchan, sizeof(*sepchan)); memcpy(sepchan, &nt->opts.sepchan, sizeof(*sepchan));
} }
} }
@ -389,7 +389,6 @@ void nctabbed_destroy(nctabbed* nt){
} }
nctab* t = nt->leftmost; nctab* t = nt->leftmost;
nctab* tmp; nctab* tmp;
t->prev->next = NULL;
while(t){ while(t){
tmp = t->next; tmp = t->next;
free(t->name); free(t->name);

Loading…
Cancel
Save