mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	Bugfix: the Y coordinate of Point config fields was not correctly validated and lead to a crash when entering non-numeric values. Includes regression test. #1906
This commit is contained in:
		
							parent
							
								
									f308a46cd5
								
							
						
					
					
						commit
						b68c55fec0
					
				
					 2 changed files with 5 additions and 3 deletions
				
			
		|  | @ -207,7 +207,7 @@ Pointf::from_SV(SV* point_sv) | |||
|     AV* point_av = (AV*)SvRV(point_sv); | ||||
|     SV* sv_x = *av_fetch(point_av, 0, 0); | ||||
|     SV* sv_y = *av_fetch(point_av, 1, 0); | ||||
|     if (!looks_like_number(sv_x) || !looks_like_number(sv_x)) return false; | ||||
|     if (!looks_like_number(sv_x) || !looks_like_number(sv_y)) return false; | ||||
|      | ||||
|     this->x = SvNV(sv_x); | ||||
|     this->y = SvNV(sv_y); | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ use strict; | |||
| use warnings; | ||||
| 
 | ||||
| use Slic3r::XS; | ||||
| use Test::More tests => 94; | ||||
| use Test::More tests => 100; | ||||
| 
 | ||||
| foreach my $config (Slic3r::Config->new, Slic3r::Config::Full->new) { | ||||
|     $config->set('layer_height', 0.3); | ||||
|  | @ -33,11 +33,13 @@ foreach my $config (Slic3r::Config->new, Slic3r::Config::Full->new) { | |||
|     ok abs($config->get_abs_value('first_layer_height') - 0.15) < 1e-4, 'set/get relative floatOrPercent'; | ||||
|     is $config->serialize('first_layer_height'), '50%', 'serialize relative floatOrPercent'; | ||||
|      | ||||
|     $config->set('print_center', [50,80]); | ||||
|     ok $config->set('print_center', [50,80]), 'valid point coordinates'; | ||||
|     is_deeply $config->get('print_center'), [50,80], 'set/get point'; | ||||
|     is $config->serialize('print_center'), '50,80', 'serialize point'; | ||||
|     $config->set_deserialize('print_center', '20,10'); | ||||
|     is_deeply $config->get('print_center'), [20,10], 'deserialize point'; | ||||
|     ok !$config->set('print_center', ['t',80]), 'invalid point X'; | ||||
|     ok !$config->set('print_center', [50,'t']), 'invalid point Y'; | ||||
|      | ||||
|     $config->set('use_relative_e_distances', 1); | ||||
|     is $config->get('use_relative_e_distances'), 1, 'set/get bool'; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Alessandro Ranellucci
						Alessandro Ranellucci