bpo-34649: Add missing NULL checks to _encoded_const() (GH-9225)

Reported by Svace static analyzer.
1 file changed