diff --git a/app/code/Magento/GiftMessage/Model/Plugin/OrderSave.php b/app/code/Magento/GiftMessage/Model/Plugin/OrderSave.php
index bb93463ef9cd303492e16c0814590e1116eed325..8acac4ecd67e230d8e0dc7c75ff7e0daee0301d9 100644
--- a/app/code/Magento/GiftMessage/Model/Plugin/OrderSave.php
+++ b/app/code/Magento/GiftMessage/Model/Plugin/OrderSave.php
@@ -61,13 +61,21 @@ class OrderSave
      */
     protected function saveOrderGiftMessage(\Magento\Sales\Api\Data\OrderInterface $order)
     {
-        if (null !== ($order->getExtensionAttributes())) {
+        if (
+            null !== $order->getExtensionAttributes() &&
+            null !== $order->getExtensionAttributes()->getGiftMessage()
+        ) {
             /* @var \Magento\GiftMessage\Api\Data\MessageInterface $giftMessage */
             $giftMessage = $order->getExtensionAttributes()->getGiftMessage();
-            try {
-                $this->giftMessageOrderRepository->save($order->getEntityId(), $giftMessage);
-            } catch (\Exception $e) {
-                throw new CouldNotSaveException(__('Could not add gift message to order: "%1"', $e->getMessage()), $e);
+            if (null !== $giftMessage) {
+                try {
+                    $this->giftMessageOrderRepository->save($order->getEntityId(), $giftMessage);
+                } catch (\Exception $e) {
+                    throw new CouldNotSaveException(
+                        __('Could not add gift message to order: "%1"', $e->getMessage()),
+                        $e
+                    );
+                }
             }
         }
         return $order;
@@ -84,7 +92,10 @@ class OrderSave
         if (null !== $order->getItems()) {
             /** @var \Magento\Sales\Api\Data\OrderItemInterface $orderItem */
             foreach ($order->getItems() as $orderItem) {
-                if (null !== ($orderItem->getExtensionAttributes())) {
+                if (
+                    null !== $orderItem->getExtensionAttributes() &&
+                    null !== $orderItem->getExtensionAttributes()->getGiftMessage()
+                ) {
                     /* @var \Magento\GiftMessage\Api\Data\MessageInterface $giftMessage */
                     $giftMessage = $orderItem->getExtensionAttributes()->getGiftMessage();
                     try {