Fix the null check for schema should occur before accessing schema.PrimaryKey

This commit is contained in:
Namhyeon Go 2025-06-26 10:26:59 +09:00
parent 82df8c5605
commit dcf966b2c5
3 changed files with 4 additions and 4 deletions

View File

@ -36,11 +36,11 @@ namespace WelsonJS.Esent
{ {
_logger = logger ?? new TraceLogger(); _logger = logger ?? new TraceLogger();
_primaryKey = schema.PrimaryKey;
if (schema == null) if (schema == null)
throw new ArgumentNullException(nameof(schema)); throw new ArgumentNullException(nameof(schema));
_primaryKey = schema.PrimaryKey;
if (_primaryKey == null) if (_primaryKey == null)
throw new ArgumentNullException(); throw new ArgumentNullException();

View File

@ -11,7 +11,7 @@ For more details, refer to the [WelsonJS Documentation](https://catswords-oss.rd
```csharp ```csharp
using WelsonJS.Esent; using WelsonJS.Esent;
// connect the database to manage an instances // connect the database to manage instances
Schema schema = new Schema("Instances", new List<Column> Schema schema = new Schema("Instances", new List<Column>
{ {
new Column("InstanceId", typeof(string), 255), new Column("InstanceId", typeof(string), 255),

View File

@ -11,7 +11,7 @@ For more details, refer to the [WelsonJS Documentation](https://catswords-oss.rd
```csharp ```csharp
using WelsonJS.Esent; using WelsonJS.Esent;
// connect the database to manage an instances // connect the database to manage instances
Schema schema = new Schema("Instances", new List<Column> Schema schema = new Schema("Instances", new List<Column>
{ {
new Column("InstanceId", typeof(string), 255), new Column("InstanceId", typeof(string), 255),