std::string constructor doesn't like null pointers
This commit is contained in:
		
							parent
							
								
									4560589e25
								
							
						
					
					
						commit
						0a484c8a31
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		| 
						 | 
					@ -123,6 +123,10 @@ static bool validUtf8(const char *string)
 | 
				
			||||||
static std::string prefPath(const char *org, const char *app)
 | 
					static std::string prefPath(const char *org, const char *app)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char *path = SDL_GetPrefPath(org, app);
 | 
						char *path = SDL_GetPrefPath(org, app);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!path)
 | 
				
			||||||
 | 
							return std::string();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	std::string str(path);
 | 
						std::string str(path);
 | 
				
			||||||
	SDL_free(path);
 | 
						SDL_free(path);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue