Skip to content

Commit

Permalink
fix: Object::_stitched can only have 1 or 2 entries
Browse files Browse the repository at this point in the history
  • Loading branch information
wravery committed Oct 22, 2024
1 parent abb31c3 commit 4d7ba4f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 2 additions & 1 deletion include/graphqlservice/GraphQLService.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "internal/DllExports.h"
#include "internal/SortedMap.h"

#include <array>
#include <chrono>
#include <condition_variable>
#include <coroutine>
Expand Down Expand Up @@ -853,7 +854,7 @@ class [[nodiscard("unnecessary construction")]] Object : public std::enable_shar
private:
TypeNames _typeNames;
ResolverMap _resolvers;
std::vector<std::shared_ptr<const Object>> _stitched;
std::array<std::shared_ptr<const Object>, 2> _stitched;
};

// Test if this Type inherits from Object.
Expand Down
10 changes: 4 additions & 6 deletions src/GraphQLService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1270,17 +1270,15 @@ std::shared_ptr<Object> Object::StitchObject(const std::shared_ptr<const Object>
hasStitchedResolvers = resolvers.emplace(name, resolver).second || hasStitchedResolvers;
}

std::vector<std::shared_ptr<const Object>> stitched { shared_from_this() };
auto object = std::make_shared<Object>(std::move(typeNames), std::move(resolvers));

object->_stitched[0] = shared_from_this();

if (hasStitchedResolvers)
{
stitched.push_back(added);
object->_stitched[1] = added;
}

auto object = std::make_shared<Object>(std::move(typeNames), std::move(resolvers));

object->_stitched = std::move(stitched);

return object;
}

Expand Down

0 comments on commit 4d7ba4f

Please sign in to comment.