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 {
237
237
238
238
public HistoryEntry getLastHistoryEntry (File file , boolean ui ) throws HistoryException {
239
239
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 ;
241
244
}
242
245
243
246
/**
Original file line number Diff line number Diff line change 26
26
import static org .junit .jupiter .api .Assertions .assertEquals ;
27
27
import static org .junit .jupiter .api .Assertions .assertNotEquals ;
28
28
import static org .junit .jupiter .api .Assertions .assertNotNull ;
29
+ import static org .junit .jupiter .api .Assertions .assertNull ;
29
30
import static org .junit .jupiter .api .Assertions .assertTrue ;
30
31
import static org .opengrok .indexer .condition .RepositoryInstalled .Type .CVS ;
31
32
import static org .opengrok .indexer .condition .RepositoryInstalled .Type .MERCURIAL ;
@@ -279,4 +280,11 @@ public void testScanningDepth() throws IOException {
279
280
280
281
env .setScanningDepth (originalScanDepth );
281
282
}
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
+ }
282
290
}
You can’t perform that action at this time.
0 commit comments