From 8a230c98a88f0696c9433f7a2e60e820929ef62f Mon Sep 17 00:00:00 2001 From: OldhamMade Date: Mon, 26 Feb 2024 20:34:33 +0100 Subject: [PATCH] [Fix] Resolve Protocol.UndefinedError by using fallback --- lib/crawly/worker.ex | 4 ++-- mix.exs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/crawly/worker.ex b/lib/crawly/worker.ex index 10a07f1..35ecdde 100644 --- a/lib/crawly/worker.ex +++ b/lib/crawly/worker.ex @@ -158,8 +158,8 @@ defmodule Crawly.Worker do parsed_item: Crawly.ParsedItem.t(), result: {:ok, :done} defp process_parsed_item({parsed_item, response, spider_name}) do - requests = Map.get(parsed_item, :requests, []) - items = Map.get(parsed_item, :items, []) + requests = Map.get(parsed_item, :requests) || [] + items = Map.get(parsed_item, :items) || [] # Process all requests one by one Enum.each( requests, diff --git a/mix.exs b/mix.exs index b5d6a77..fbc64d8 100644 --- a/mix.exs +++ b/mix.exs @@ -2,7 +2,7 @@ defmodule Crawly.Mixfile do use Mix.Project @source_url "https://github.com/oltarasenko/crawly" - @version "0.16.0" + @version "0.16.1" def project do [