Add test for entry state machine.
diff --git a/include/rive/artboard.hpp b/include/rive/artboard.hpp
index 3c52a68..2dfc2f5 100644
--- a/include/rive/artboard.hpp
+++ b/include/rive/artboard.hpp
@@ -164,6 +164,7 @@
 
         std::unique_ptr<StateMachineInstance> stateMachineAt(size_t index);
         std::unique_ptr<StateMachineInstance> stateMachineNamed(const std::string& name);
+        std::unique_ptr<StateMachineInstance> defaultStateMachineInstance();
     };
 } // namespace rive
 
diff --git a/src/artboard.cpp b/src/artboard.cpp
index 1d862b7..5a865ea 100644
--- a/src/artboard.cpp
+++ b/src/artboard.cpp
@@ -528,7 +528,7 @@
 }
 
 StateMachine* Artboard::defaultStateMachine() const {
-    if (defaultStateMachineId() > m_StateMachines.size()) {
+    if (defaultStateMachineId() >= m_StateMachines.size()) {
         return nullptr;
     }
     return m_StateMachines[defaultStateMachineId()];
@@ -616,3 +616,8 @@
     auto sm = this->stateMachine(name);
     return sm ? std::make_unique<StateMachineInstance>(sm, this) : nullptr;
 }
+
+std::unique_ptr<StateMachineInstance> ArtboardInstance::defaultStateMachineInstance() {
+    auto sm = this->defaultStateMachine();
+    return sm ? std::make_unique<StateMachineInstance>(sm, this) : nullptr;
+}
\ No newline at end of file
diff --git a/test/assets/entry.riv b/test/assets/entry.riv
new file mode 100644
index 0000000..22b208f
--- /dev/null
+++ b/test/assets/entry.riv
Binary files differ
diff --git a/test/default_state_machine_test.cpp b/test/default_state_machine_test.cpp
new file mode 100644
index 0000000..f9f8ff6
--- /dev/null
+++ b/test/default_state_machine_test.cpp
@@ -0,0 +1,27 @@
+#include <rive/file.hpp>
+#include <rive/node.hpp>
+#include <rive/shapes/clipping_shape.hpp>
+#include <rive/shapes/rectangle.hpp>
+#include <rive/shapes/shape.hpp>
+#include <rive/animation/state_machine_instance.hpp>
+#include "no_op_factory.hpp"
+#include "no_op_renderer.hpp"
+#include "rive_file_reader.hpp"
+#include <catch.hpp>
+#include <cstdio>
+
+TEST_CASE("default state machine is detected at load", "[file]") {
+    auto file = ReadRiveFile("../../test/assets/entry.riv");
+
+    auto artboard = file->artboard();
+
+    REQUIRE(artboard->defaultStateMachine() != nullptr);
+    REQUIRE(artboard->defaultStateMachine()->name() == "State Machine 1");
+
+    auto artboardInstance = artboard->instance();
+    REQUIRE(artboardInstance != nullptr);
+    auto defaultStateMachineInstance = artboardInstance->defaultStateMachineInstance();
+
+    REQUIRE(defaultStateMachineInstance != nullptr);
+    REQUIRE(defaultStateMachineInstance->name() == "State Machine 1");
+}