1
0
mirror of https://github.com/bitwarden/server synced 2026-02-14 15:33:35 +00:00

Add null check for instanceName to prevent an unlikely null ref

This commit is contained in:
Daniel James Smith
2025-11-28 15:34:48 +01:00
parent b002e53be6
commit f017479f0b

View File

@@ -35,8 +35,13 @@ public abstract class BaseJobsHostedService : IHostedService, IDisposable
public virtual async Task StartAsync(CancellationToken cancellationToken)
{
var fullName = GetType().FullName;
if (fullName == null)
{
throw new InvalidOperationException("Hosted service must have a valid type name.");
}
var schedulerBuilder = SchedulerBuilder.Create()
.WithName(GetType().FullName) // Ensure each project has a unique instanceName
.WithName(fullName) // Ensure each project has a unique instanceName
.WithId("AUTO")
.UseJobFactory<JobFactory>();