script: fix crash on "/script update" if a script detail is displayed in buffer (closes #177)

(cherry picked from commit 067f310be66118814b4e8a75cc6e18ae7a4d3da4)