Bug #3932
assertion triggered with multipart strings
| Status: | Closed | Start date: | 2012-04-22 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 100% |
|
| Category: | - | |||
| Target version: | - |
Description
possibly related to #3642
When I compose a multipart string, e.g.:
additional_text: return string(str_purchase_svc_len_lsp, string(str_purchase_svc_lpxx), string(str_purchase_len_2_10), string(str_purchase_lsp_5));
And one of the parameter-strings is not defined in the language file, I get an assertion rather then a "string xxx missing".
nmlc: An internal error has occurred: nmlc-version: r1880 (9404bd6a9426) Error: (AssertionError) . Command: ['/usr/bin/nmlc', '-p', 'DOS', 'dutchtrains.nml'] Location: File "/usr/lib/python2.7/site-packages/nml-r1880-py2.7.egg/nml/grfstrings.py", line 670, in get_string
Associated revisions
History
#1 Updated by Alberth 12 months ago
- File andy_crash.patch
added
Andythenorth had a similar problem in the FISH project, in revision 749.
Stack-dump (of nml r1908):
Traceback (most recent call last):
File "~/bin/nmlc", line 6, in <module>
main.run()
File "~/nml/hg_trunk/nml/main.py", line 305, in run
main(sys.argv[1:])
File "~/nml/hg_trunk/nml/main.py", line 154, in main
ret = nml(input, input_filename, opts.debug, outputs, opts.sprites_dir, opts.start_sprite_num, opts.forced_palette, opts.md5_filename)
File "~/nml/hg_trunk/nml/main.py", line 216, in nml
lang_actions.extend(action4.get_global_string_actions())
File "~/nml/hg_trunk/nml/actions/action4.py", line 100, in get_global_string_actions
texts.append( (0x7F, (string_range << 8) | id, grfstrings.get_translation(string_name), feature) )
File "~/nml/hg_trunk/nml/grfstrings.py", line 127, in get_translation
return default_lang.get_string(string)
File "~/nml/hg_trunk/nml/grfstrings.py", line 817, in get_string
parsed_string += self.strings[string_id].parse_string(str_type, self, string.params)
File "~/nml/hg_trunk/nml/grfstrings.py", line 547, in parse_string
ret += comp.parse_string(str_type, lang, stack, static_args)
File "~/nml/hg_trunk/nml/grfstrings.py", line 334, in parse_string
return commands[self.name]['parse'](static_args[self.str_pos], lang.langid)
File "~/nml/hg_trunk/nml/grfstrings.py", line 160, in com_parse_string
return get_translation(val, lang_id)
File "~/nml/hg_trunk/nml/grfstrings.py", line 127, in get_translation
return default_lang.get_string(string)
File "~/nml/hg_trunk/nml/grfstrings.py", line 806, in get_string
assert string_id in self.strings
grfstrings.get_translation() seemed to be a good entry point for a check, so I wrote the attached patch which checks whether the string exists in the default language before querying it and raises an exception if not.
#3 Updated by Hirundo 11 months ago
- Status changed from New to Closed
- % Done changed from 0 to 100
Applied in changeset a5a804dc81fa.