Why does defining a value make the script break when the value is not even used
Yes, errors in the script's draw function will stop it from drawing beyond the line where the error happens (or it will stop drawing your panel entirely). The error you got is:

location: &lt;unknown location&gt;:-1
Traceback (most recent call last):
  File "/ui_panel.py", line ---, in draw
AttributeError: 'Context' object has no attribute 'material'


Fix this error and the panel will draw OK. It means context.material is the problem.

Get in the habit of starting Blender from Terminal during experimentation / development process. This will allow you to read the errors that occur when Blender doesn't explicitly tell you something's wrong.