mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-01-09 17:12:15 +01:00
Fixed bug
This commit is contained in:
@@ -61,7 +61,12 @@ public final class LinkEnricherContext {
|
||||
* @return instance
|
||||
*/
|
||||
public <T> T oneRequireByType(Class<T> type) {
|
||||
return oneByType(type).get();
|
||||
Optional<T> instance = oneByType(type);
|
||||
if (instance.isPresent()) {
|
||||
return instance.get();
|
||||
} else {
|
||||
throw new NoSuchElementException("No instance for given type present");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user