{"id":821,"date":"2021-03-16T13:58:52","date_gmt":"2021-03-16T13:58:52","guid":{"rendered":"http:\/\/morecpq.com\/?p=821"},"modified":"2021-04-09T15:18:56","modified_gmt":"2021-04-09T15:18:56","slug":"error-message-in-generate-document-attempt-to-de-reference-a-null-object","status":"publish","type":"post","link":"https:\/\/morecpq.com\/index.php\/2021\/03\/16\/error-message-in-generate-document-attempt-to-de-reference-a-null-object\/","title":{"rendered":"Error Message in Generate Document: Attempt to de-reference a null object"},"content":{"rendered":"\n<p>This error.  Is the worst.  It appears everywhere and indicates no detail about why the error happens.  WTF.  This will be a thread of reasons why this could happen.  The first reason is below.<\/p>\n\n\n\n<p><strong>Block Pricing Product without Blocks!<\/strong><\/p>\n\n\n\n<p>Whaaaaaat.  It turns out if you have a block priced product without block prices, you get this error.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"138\" height=\"47\" src=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/03\/image-4.png?resize=138%2C47\" alt=\"\" class=\"wp-image-826\"\/><figcaption>Pricing Method: Block<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"150\" height=\"48\" src=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/03\/image-2.png?resize=150%2C48\" alt=\"\" class=\"wp-image-824\"\/><figcaption>Block Pricing Field: Quantity<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/03\/image-5.png?resize=499%2C150\" alt=\"\" class=\"wp-image-828\" width=\"499\" height=\"150\" srcset=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/03\/image-5.png?w=800&amp;ssl=1 800w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/03\/image-5.png?resize=300%2C90&amp;ssl=1 300w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/03\/image-5.png?resize=768%2C231&amp;ssl=1 768w\" sizes=\"(max-width: 499px) 100vw, 499px\" \/><figcaption>Block Prices: None!<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/03\/image-3.png?resize=465%2C162\" alt=\"\" class=\"wp-image-825\" width=\"465\" height=\"162\" srcset=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/03\/image-3.png?w=815&amp;ssl=1 815w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/03\/image-3.png?resize=300%2C105&amp;ssl=1 300w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/03\/image-3.png?resize=768%2C268&amp;ssl=1 768w\" sizes=\"(max-width: 465px) 100vw, 465px\" \/><figcaption>Generate Document: Attempt to de-reference a null object<\/figcaption><\/figure>\n\n\n\n<p>The actual cause of the error is having a lines section trying to display a line with null values for all of the calculated fields.  Which happens if you have a block priced product with no block prices.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/03\/image-6.png?resize=471%2C440\" alt=\"\" class=\"wp-image-830\" width=\"471\" height=\"440\" srcset=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/03\/image-6.png?w=613&amp;ssl=1 613w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/03\/image-6.png?resize=300%2C280&amp;ssl=1 300w\" sizes=\"(max-width: 471px) 100vw, 471px\" \/><figcaption>Pricing Information: Null Values<\/figcaption><\/figure>\n\n\n\n<p>Another one!<\/p>\n\n\n\n<p>Over-formatting of merged text, text-area, or rich text fields. If a user pastes from Word (or similar) and includes a table (or similar), it will cause this error when rendering Quote Document. Solution:  Review the values of any merged, text-area, or rich text fields referenced in your Quote Template.  You can do this easily by extracting the data with Data Loader and reviewing the output CSV for any crazy HTML formatting.  Remove it and do an update with Data Loader!<\/p>\n\n\n\n<p>There you have it.  I&#8217;ll add to this post if and when I find another one of these.  \ud83d\udc4d\ud83c\udffb \u270c\ud83c\udffb <\/p>\n","protected":false},"excerpt":{"rendered":"<p>This error. Is the worst. It appears everywhere and indicates no detail about why the error happens. WTF. This will be a thread of reasons why this could happen. The first reason is below. Block Pricing Product without Blocks! Whaaaaaat. It turns out if you have a block priced product without block prices, you get &hellip;<br \/><a href=\"https:\/\/morecpq.com\/index.php\/2021\/03\/16\/error-message-in-generate-document-attempt-to-de-reference-a-null-object\/\" class=\"more-link pen_button pen_element_default pen_icon_arrow_double\">Continue reading <span class=\"screen-reader-text\">Error Message in Generate Document: Attempt to de-reference a null object<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-821","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/posts\/821","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/comments?post=821"}],"version-history":[{"count":8,"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/posts\/821\/revisions"}],"predecessor-version":[{"id":874,"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/posts\/821\/revisions\/874"}],"wp:attachment":[{"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/media?parent=821"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/categories?post=821"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/tags?post=821"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}