Font: 'exist?' allows any object (returns false if not string)
This commit is contained in:
		
							parent
							
								
									6c9fbc1465
								
							
						
					
					
						commit
						cc0ab35f10
					
				
					 3 changed files with 17 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -30,8 +30,13 @@ DEF_TYPE(Font);
 | 
			
		|||
 | 
			
		||||
MRB_FUNCTION(fontDoesExist)
 | 
			
		||||
{
 | 
			
		||||
	const char *name;
 | 
			
		||||
	mrb_get_args(mrb, "z", &name);
 | 
			
		||||
	const char *name = 0;
 | 
			
		||||
	mrb_value nameObj;
 | 
			
		||||
 | 
			
		||||
	mrb_get_args(mrb, "o", &nameObj);
 | 
			
		||||
 | 
			
		||||
	if (mrb_string_p(nameObj))
 | 
			
		||||
		name = mrb_string_value_cstr(mrb, &nameObj);
 | 
			
		||||
 | 
			
		||||
	return mrb_bool_value(Font::doesExist(name));
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue