Use `headers` attribute for toolchains only if it is set (#3704)

diff --git a/nodejs/toolchain.bzl b/nodejs/toolchain.bzl
index 7980ed2..546105a 100644
--- a/nodejs/toolchain.bzl
+++ b/nodejs/toolchain.bzl
@@ -102,7 +102,7 @@
                 "CcInfo": ctx.attr.headers[CcInfo],
                 "DefaultInfo": ctx.attr.headers[DefaultInfo],
             },
-        ),
+        ) if ctx.attr.headers else None,
     )
 
     # Export all the providers inside our ToolchainInfo