fookb: Fix error handling when reading XPM files.
Previously, we would try and read the width and height of images read from an XPM file *before* doing any error handling to determine whether we successfully read the file in the first place. If there had been an error, then there would be a segfault.
This commit is contained in:
		
							parent
							
								
									279eb3c3fe
								
							
						
					
					
						commit
						b8ce2c9cd2
					
				
					 1 changed files with 3 additions and 0 deletions
				
			
		| 
						 | 
					@ -38,6 +38,9 @@ static int get_one_image(char *name, int index, Display *dpy)
 | 
				
			||||||
	foo = XpmReadFileToImage(dpy, name, &stupid_picture[index],
 | 
						foo = XpmReadFileToImage(dpy, name, &stupid_picture[index],
 | 
				
			||||||
				 NULL, NULL);
 | 
									 NULL, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (foo < 0)
 | 
				
			||||||
 | 
							return foo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (0 == w) {
 | 
						if (0 == w) {
 | 
				
			||||||
		w = stupid_picture[index]->width;
 | 
							w = stupid_picture[index]->width;
 | 
				
			||||||
		if (0 == w) {
 | 
							if (0 == w) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue