Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: X-link: facebookexternal/meta-ar-mr-tooling#93 Pull Request resolved: #1037 Crashes like https://fburl.com/logview/p23dzrkw (https://fburl.com/logview/8z9nspug) happen when a list is non-null but empty. I reason that if null was a reasonable return, then an empty list can be a null instead of crashing. This isn't common, but spiked during SEV 0 S475626. Basically `?.first()` -> `?.firstOrNull()` as a dumb codemod: ``` for i in `xbgs -l -f '.*\.kt' '?.last()' | sed -e 's/^fbsource\///'`; do sed -i '' 's/\?\.last()/?.lastOrNull()/g' $i; done for i in `xbgs -l -f '.*\.kt' '?.first()' | sed -e 's/^fbsource\///'`; do sed -i '' 's/\?\.first()/?.firstOrNull()/g' $i; done arc f ``` Reviewed By: adityasharat Differential Revision: D67113975 fbshipit-source-id: d226a84179a822c59310410593b1ed8f7b12cfa0
- Loading branch information