Commit 85b449b62da2f2493d8bdae7607787dbc203e780
Committed by
Andrew Shvayka
1 parent
7975e2a9
Improvements for case null returned from repository
Showing
1 changed file
with
2 additions
and
1 deletions
... | ... | @@ -31,6 +31,7 @@ import org.thingsboard.server.common.data.Tenant; |
31 | 31 | import org.thingsboard.server.common.data.User; |
32 | 32 | import org.thingsboard.server.common.data.id.CustomerId; |
33 | 33 | import org.thingsboard.server.common.data.id.DashboardId; |
34 | +import org.thingsboard.server.common.data.id.IdBased; | |
34 | 35 | import org.thingsboard.server.common.data.id.TenantId; |
35 | 36 | import org.thingsboard.server.common.data.oauth2.OAuth2MapperConfig; |
36 | 37 | import org.thingsboard.server.common.data.oauth2.OAuth2Registration; |
... | ... | @@ -205,7 +206,7 @@ public abstract class AbstractOAuth2ClientMapper { |
205 | 206 | } |
206 | 207 | |
207 | 208 | private Optional<DashboardId> getDashboardId(TenantId tenantId, String dashboardName) { |
208 | - return Optional.of(dashboardService.findFirstDashboardInfoByTenantIdAndName(tenantId, dashboardName).getId()); | |
209 | + return Optional.ofNullable(dashboardService.findFirstDashboardInfoByTenantIdAndName(tenantId, dashboardName)).map(IdBased::getId); | |
209 | 210 | } |
210 | 211 | |
211 | 212 | private Optional<DashboardId> getDashboardId(TenantId tenantId, CustomerId customerId, String dashboardName) { | ... | ... |