Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

open_db on corrupted file crases project #141

Open
JonnyTech opened this issue May 5, 2023 · 0 comments
Open

open_db on corrupted file crases project #141

JonnyTech opened this issue May 5, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@JonnyTech
Copy link

JonnyTech commented May 5, 2023

Environment:

  • OS: Debian and Windows
  • Godot version: 4.0.2
  • godot-sqlite version: 4.0

Issue description:
Trying to open a corrupted / non-sqlite file crashes the project.
Expecting to trap the error and handle it safely

Steps to reproduce:
Create 3 buttons: create db, fill db, read db

func create_db():
	db.open_db()
	db.drop_table("table")
	db.create_table("table",{...table-data...})
	db.close_db()

func fill_db():
	db.open_db()
	db.insert_rows("table", row_array):
	db.close_db()

func read_db():
	db.open_db()
	#db.query()
	db.close_db()

Pressing the buttons in order (create, fill, read) works ok.
Delete the database file test.db
Press to fill the db >> an empty zero byte test.db file is created.
Press to read the database, crash on db.open because test.db is not a valid db file

Additional context
This is obviously a non-real-world example, but I have had an issue where the database file was unavailable and the fill/read process did happen and cause the result.

@JonnyTech JonnyTech added the bug Something isn't working label May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant