瀏覽代碼

Fortify against missing purpose

(Humanity could use that)
Alois Mahdal 10 年之前
父節點
當前提交
ef0e500332
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3
    1
      bin/mkexec

+ 3
- 1
bin/mkexec 查看文件

@@ -124,7 +124,9 @@ sub mkbody {
124 124
     my $type = shift;
125 125
     my $purpose = shift;
126 126
     my $tmpl = "";
127
-    $tmpl .= $templates->{$type}->{$purpose} if exists $templates->{$type};
127
+    $tmpl .= $templates->{$type}->{$purpose}
128
+        if exists $templates->{$type}
129
+            and exists $templates->{$type}->{$purpose};
128 130
     return sprintf "#!%s\n%s\n", $bangs->{$type}, $tmpl;
129 131
 }
130 132