diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2024-12-06 01:09:42 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2024-12-06 01:09:42 +0100 |
commit | e3c799dc95f2c5569f8a12f1bb7ec190950e4bdd (patch) | |
tree | 58155f74f3dcef1161ad60f3d997fa408aa7f19e /org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java | |
parent | bd57a19fa35b6de493926e2996b28235b96b5690 (diff) | |
parent | cca2ef12eec44b5b2140761baf13e2a611a654f3 (diff) | |
download | jgit-e3c799dc95f2c5569f8a12f1bb7ec190950e4bdd.tar.gz jgit-e3c799dc95f2c5569f8a12f1bb7ec190950e4bdd.zip |
Merge branch 'stable-7.1'
* stable-7.1:
FileSnapshot: silence "Not a Directory" exceptions
FileSnapshot: refactor to share error handling
Mark Attribute#getValue as @Nullable
Fix potential NPE in ResolveMerger#getAttributesContentMergeStrategy
Fix NPE in DiffFormatter#getDiffDriver
Pack: ensure packfile is still valid while still recoverable
WindowCache: add bulk purge(), call from bulk sites
UploadPack#implies: add missing @since tag
Disable MergeToolTest#testEmptyToolName
Change-Id: Ifa8df2b9e6e4ee371113b7114fe20b42333e3718
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java index bc07cedf4f..cbac3f90b7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java @@ -1356,13 +1356,17 @@ public class DiffFormatter implements AutoCloseable { private DiffDriver getDiffDriver(DiffEntry entry) { Attribute diffAttr = entry.getDiffAttribute(); - if (diffAttr != null) { - try { - return DiffDriver.valueOf(diffAttr.getValue()); - } catch (IllegalArgumentException e) { - return null; - } + if (diffAttr == null) { + return null; + } + String diffAttrValue = diffAttr.getValue(); + if (diffAttrValue == null) { + return null; + } + try { + return DiffDriver.valueOf(diffAttrValue); + } catch (IllegalArgumentException e) { + return null; } - return null; } } |