mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	find prev/next output/workspace: add NULL check
These could be called with NULL if there is no focus Found through static analysis.
This commit is contained in:
		
							parent
							
								
									ab18740529
								
							
						
					
					
						commit
						9c9ee3e4ef
					
				
					 1 changed files with 6 additions and 0 deletions
				
			
		| 
						 | 
					@ -271,6 +271,9 @@ struct sway_container *workspace_by_name(const char *name) {
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
struct sway_container *workspace_output_prev_next_impl(
 | 
					struct sway_container *workspace_output_prev_next_impl(
 | 
				
			||||||
		struct sway_container *output, bool next) {
 | 
							struct sway_container *output, bool next) {
 | 
				
			||||||
 | 
						if (!output) {
 | 
				
			||||||
 | 
							return NULL;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	if (!sway_assert(output->type == C_OUTPUT,
 | 
						if (!sway_assert(output->type == C_OUTPUT,
 | 
				
			||||||
				"Argument must be an output, is %d", output->type)) {
 | 
									"Argument must be an output, is %d", output->type)) {
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
| 
						 | 
					@ -303,6 +306,9 @@ struct sway_container *workspace_output_prev_next_impl(
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
struct sway_container *workspace_prev_next_impl(
 | 
					struct sway_container *workspace_prev_next_impl(
 | 
				
			||||||
		struct sway_container *workspace, bool next) {
 | 
							struct sway_container *workspace, bool next) {
 | 
				
			||||||
 | 
						if (!workspace) {
 | 
				
			||||||
 | 
							return NULL;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	if (!sway_assert(workspace->type == C_WORKSPACE,
 | 
						if (!sway_assert(workspace->type == C_WORKSPACE,
 | 
				
			||||||
				"Argument must be a workspace, is %d", workspace->type)) {
 | 
									"Argument must be a workspace, is %d", workspace->type)) {
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue