diff --git a/scripts/asn1_compiler.c b/scripts/asn1_compiler.c
index e000f44e37b8775f45023464b765a460d92d1204..c1b7ef3e24c1c055cc90d1e986b11308ff7d2e02 100644
--- a/scripts/asn1_compiler.c
+++ b/scripts/asn1_compiler.c
@@ -650,7 +650,7 @@ int main(int argc, char **argv)
 	}
 
 	hdr = fopen(headername, "w");
-	if (!out) {
+	if (!hdr) {
 		perror(headername);
 		exit(1);
 	}