File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
main/java/org/opengrok/indexer/history
test/java/org/opengrok/indexer/history Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -237,7 +237,10 @@ public History getHistoryUI(File file) throws HistoryException {
237237
238238 public HistoryEntry getLastHistoryEntry (File file , boolean ui ) throws HistoryException {
239239 final Repository repo = getRepository (file );
240- return repo .getLastHistoryEntry (file , ui );
240+ if (repo != null ) {
241+ return repo .getLastHistoryEntry (file , ui );
242+ }
243+ return null ;
241244 }
242245
243246 /**
Original file line number Diff line number Diff line change 2626import static org .junit .jupiter .api .Assertions .assertEquals ;
2727import static org .junit .jupiter .api .Assertions .assertNotEquals ;
2828import static org .junit .jupiter .api .Assertions .assertNotNull ;
29+ import static org .junit .jupiter .api .Assertions .assertNull ;
2930import static org .junit .jupiter .api .Assertions .assertTrue ;
3031import static org .opengrok .indexer .condition .RepositoryInstalled .Type .CVS ;
3132import static org .opengrok .indexer .condition .RepositoryInstalled .Type .MERCURIAL ;
@@ -279,4 +280,11 @@ public void testScanningDepth() throws IOException {
279280
280281 env .setScanningDepth (originalScanDepth );
281282 }
283+
284+ @ Test
285+ void testGetLastHistoryEntry () throws HistoryException {
286+ HistoryGuru instance = HistoryGuru .getInstance ();
287+ File file = new File ("/nonexistent" );
288+ assertNull (instance .getLastHistoryEntry (file , true ));
289+ }
282290}
You can’t perform that action at this time.
0 commit comments