Repository navigation
Fix load_dependencies crash on externals without a path - #404
Open
1915rising wants to merge 1 commit into
Open
1915rising wants to merge 1 commit into
1915rising wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #326.
SerializedFile.load_dependencies()crashes for SerializedFiles whose externals include an entry without a path.load_file(None)falls through tocheck_file_type(None), which raisesTypeError: Unsupported type for EndianBinaryReader: <class 'NoneType'>and aborts the whole load. Thepossible_dependenciesloop directly below already tolerates missing files, but the externals loop had no guard at all.Reproduction (minimal, on current master): a
SerializedFilewith an external whosepathisNoneraisesAn external pointing at a file that does not exist (the reporter's
Library/unity default resourcescase) already returnsNonefromload_filesince 8eb6a5e and does not crash; theNone-path case is the remaining hole.Fix: skip externals whose
pathis falsy, and wrap the externals loop in the sametry/except FileNotFoundErrorthepossible_dependenciesloop already uses.Tests:
test_load_dependencies_missing_externalsintests/test_main.pycovering a None-path external, a missing-file external, and a missing possible dependency.test_extractorand 3test_mesh_helpertests need Git-LFS sample files that are not fetched in my environment) and are identical before and after.Disclosure: I also have two other PRs open in this repo, #401 and #402, for separate issues.