Skip to content

Commit

Permalink
Merge pull request #35 from 51Degrees/feature/fix-getting-started-exa…
Browse files Browse the repository at this point in the history
…mple

BUG/MINOR: Fix limiting properties available in example.
  • Loading branch information
jwrosewell authored Jul 4, 2023
2 parents 798d431 + 684ceec commit b2e2e67
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions examples/C/Hash/GettingStarted.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,13 @@ static void outputValue(
DataSetHash* dataset = (DataSetHash*)results->b.b.dataSet;

EXCEPTION_CREATE;
int propertyIndex = PropertiesGetPropertyIndexFromName(dataset->b.b.available, propertyName);
int requiredPropertyIndex = PropertiesGetRequiredPropertyIndexFromName(
dataset->b.b.available,
propertyName);
// If a value has not been set then trying to access the value will
// result in an exception.
if (ResultsHashGetHasValues(
results, propertyIndex, exception)) {
results, requiredPropertyIndex, exception)) {
ResultsHashGetValuesString(
results,
propertyName,
Expand All @@ -135,7 +137,7 @@ static void outputValue(
// A no value message can also be obtained. This message describes why
// the value has not been set.
fiftyoneDegreesResultsNoValueReason reason =
ResultsHashGetNoValueReason(results, propertyIndex, exception);
ResultsHashGetNoValueReason(results, requiredPropertyIndex, exception);
EXCEPTION_THROW;

sprintf(valueBuffer, "Unknown (%s)", ResultsHashGetNoValueReasonMessage(reason));
Expand Down

0 comments on commit b2e2e67

Please sign in to comment.