mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 01:34:18 +00:00 
			
		
		
		
	Check for NULL session and whatnot in status_replace, from Thomas Adam.
This commit is contained in:
		
							
								
								
									
										18
									
								
								status.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								status.c
									
									
									
									
									
								
							@@ -445,11 +445,11 @@ status_replace(struct client *c, struct session *s, struct winlink *wl,
 | 
				
			|||||||
	if (fmt == NULL)
 | 
						if (fmt == NULL)
 | 
				
			||||||
		return (xstrdup(""));
 | 
							return (xstrdup(""));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (s == NULL)
 | 
						if (s == NULL && c != NULL)
 | 
				
			||||||
		s = c->session;
 | 
							s = c->session;
 | 
				
			||||||
	if (wl == NULL)
 | 
						if (wl == NULL && s != NULL)
 | 
				
			||||||
		wl = s->curw;
 | 
							wl = s->curw;
 | 
				
			||||||
	if (wp == NULL)
 | 
						if (wp == NULL && wl != NULL)
 | 
				
			||||||
		wp = wl->window->active;
 | 
							wp = wl->window->active;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	len = strftime(in, sizeof in, fmt, localtime(&t));
 | 
						len = strftime(in, sizeof in, fmt, localtime(&t));
 | 
				
			||||||
@@ -472,10 +472,14 @@ status_replace(struct client *c, struct session *s, struct winlink *wl,
 | 
				
			|||||||
	*optr = '\0';
 | 
						*optr = '\0';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ft = format_create();
 | 
						ft = format_create();
 | 
				
			||||||
	format_client(ft, c);
 | 
						if (c != NULL)
 | 
				
			||||||
	format_session(ft, s);
 | 
							format_client(ft, c);
 | 
				
			||||||
	format_winlink(ft, s, wl);
 | 
						if (s != NULL)
 | 
				
			||||||
	format_window_pane(ft, wp);
 | 
							format_session(ft, s);
 | 
				
			||||||
 | 
						if (s != NULL && wl != NULL)
 | 
				
			||||||
 | 
							format_winlink(ft, s, wl);
 | 
				
			||||||
 | 
						if (wp != NULL)
 | 
				
			||||||
 | 
							format_window_pane(ft, wp);
 | 
				
			||||||
	expanded = format_expand(ft, out);
 | 
						expanded = format_expand(ft, out);
 | 
				
			||||||
	format_free(ft);
 | 
						format_free(ft);
 | 
				
			||||||
	return (expanded);
 | 
						return (expanded);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user