mirror of
https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git
synced 2026-05-15 13:42:40 -07:00
Prevent GUI from crashing when invalid values were written in numeric fields. Includes basic validation. #1709
This commit is contained in:
@@ -201,12 +201,17 @@ Pointf::to_SV_pureperl() const {
|
||||
return newRV_noinc((SV*)av);
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
Pointf::from_SV(SV* point_sv)
|
||||
{
|
||||
AV* point_av = (AV*)SvRV(point_sv);
|
||||
this->x = SvNV(*av_fetch(point_av, 0, 0));
|
||||
this->y = SvNV(*av_fetch(point_av, 1, 0));
|
||||
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;
|
||||
|
||||
this->x = SvNV(sv_x);
|
||||
this->y = SvNV(sv_y);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user