robhagemans / pcbasic

PC-BASIC - A free, cross-platform emulator for the GW-BASIC family of interpreters
http://www.pc-basic.org
Other
397 stars 48 forks source link

Trying to delete non-existent line causes crash #134

Closed richmilne closed 3 years ago

richmilne commented 3 years ago

Bug report

Problem When I enter a number (which currently doesn't exist as a line number) and press enter, the interpreter crashes. I'd expect that either nothing happens, or some error message is printed. From the resulting stack trace dump, the relevant lines seem to be:

    raise error.BASICError(error.UNDEFINED_LINE_NUMBER)
pcbasic.basic.base.error.BASICError

During handling of the above exception, another exception occurred:
...
  File "/mnt/c/Users/me/Documents/Working/pc_basic/venv/lib/python3.6/site-packages/pcbasic/basic/program.py", line 98, in get_line_number
    if linum_pos <= pos and linum > pre:
TypeError: '<=' not supported between instances of 'int' and 'NoneType'

Steps

  1. Start PC-BASIC
  2. Type "10" (without quotes) into interpreter window
  3. Press Enter
  4. crash!

Crash log crash-20210224-6uol53kh.log

Notes version 2.0.2 [66c62e30f] v2.0.2 2019-02-10 09:09:51.819136 python 3.6.9 [64bit ELF] platform Linux-4.4.0-19041-Microsoft-x86_64-with-Ubuntu-18.04-bionic interface VideoSDL2, AudioSDL2

Marrin commented 3 years ago

This seems to be fixed in 2.0.3:

PC-BASIC 2.0.3
(C) Copyright 2013--2020 Rob Hagemans.
60300 Bytes free
Ok 
10
Undefined line number 
Ok 
richmilne commented 3 years ago

You're correct, @Marrin.

Apologies, all... I should have checked against the latest version before posting a bug report.