bugfix: assert not null

This commit is contained in:
waltem01 2024-02-15 09:27:05 +01:00
parent 233d8b6f82
commit c81223fe5b

View File

@ -18,6 +18,7 @@ def display_text():
response = { 'success': True }
try:
global matrix
assert matrix is not None
# receive client data
data = request.form
@ -43,6 +44,7 @@ def set_pixel():
response = { 'success': True }
try:
global matrix
assert matrix is not None
# receive client data
data = request.form
@ -67,6 +69,7 @@ def draw_circle():
response = { 'success': True }
try:
global matrix
assert matrix is not None
# receive client data
data = request.form
@ -92,6 +95,7 @@ def draw_rectangle():
response = { 'success': True }
try:
global matrix
assert matrix is not None
# receive client data
data = request.form
@ -119,6 +123,7 @@ def set_color():
response = { 'success': True }
try:
global matrix
assert matrix is not None
# receive client data
data = request.form
@ -144,6 +149,7 @@ def clear_canvas():
response = { 'success': True }
try:
global matrix
assert matrix is not None
# clear matrix canvas
matrix.clear()
@ -152,6 +158,7 @@ def clear_canvas():
print(e)
response['success'] = False
# respond to client
return jsonify(response)
@api.route('/update', methods=['GET'])
@ -160,6 +167,7 @@ def update_matrix():
response = { 'success': True }
try:
global matrix
assert matrix is not None
# swap matrix canvas
matrix.update()