summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-04-05 09:26:00 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-04-05 09:26:00 -0400
commit2521a87414f0027e8fcef6b80fa414a5e0c20272 (patch)
tree58141d6d89f51fcbceb8bed54f35c38f50120d60 /src
parentcd768be8105e43b8c8d0cf1578528a02f5341a95 (diff)
Avoid generating empty <script> blocks
Diffstat (limited to 'src')
-rw-r--r--src/c/urweb.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/c/urweb.c b/src/c/urweb.c
index 476fb09b..9915219d 100644
--- a/src/c/urweb.c
+++ b/src/c/urweb.c
@@ -692,6 +692,8 @@ void uw_write_script(uw_context ctx, uw_Basis_string s) {
const char *uw_Basis_get_script(uw_context ctx, uw_unit u) {
if (ctx->script_header[0] == 0)
return "";
+ else if (buf_used(&ctx->script) == 0)
+ return ctx->script_header;
else {
char *r = uw_malloc(ctx, strlen(ctx->script_header) + 42 + buf_used(&ctx->script));
sprintf(r, "%s<script type=\"text/javascript\">%s</script>",