parnoldx / nasc

Do maths like a normal person
http://parnoldx.github.io/nasc/
GNU General Public License v3.0
560 stars 37 forks source link

Crash on function declaration with number in name without expression #182

Closed MEXAHOTABOP closed 3 years ago

MEXAHOTABOP commented 3 years ago

Describe the bug NaSC crashes when you try decelerate function with number in name without expression

[FATAL 15:51:43.595707] string_chug: assertion 'self != NULL' failed
[FATAL 15:51:43.595723] string_chomp: assertion 'self != NULL' failed
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid

To Reproduce Steps to reproduce the behavior:

  1. Open empty sheet in NaSC
  2. Type function f1
  3. Program crashed

Expected behavior https://github.com/parnold-x/nasc/blob/master/src/Calculator.vala#L234 must have a check that expression part is not null before using it

Desktop (please complete the following information):