[Warning] Attempt to read property "Type" on null

GET /badge-detail-page?ID=12&TYPE=Executive

Line 80 in /home/bborg/public_html/app/src/BadgeDetailPageController.php

Source

71 	}
72 
73 	public function getBadgeTypeColour() {
74 		$badgeid = $this->getBadgeid();
75 
76 		$badge = DataObject::get_by_id("Badge",$badgeid);
77 
78 		
79 
80 		$badgetype = $badge->Type;
81 		//print_r($badgetype);exit;
82 
83 		//give a default badge id of 1 for the listing
84 		if($badgetype  == "Anchor") {
85 			return "#4caf53";
86 			}

Trace

ERROR [User Warning]: Couldn't set response type to 500 because of output on line 419 of /home/bborg/public_html/vendor/silverstripe/framework/src/Control/HTTPResponse.php IN GET /badge-detail-page?ID=12&TYPE=Executive Line 397 in /home/bborg/public_html/vendor/silverstripe/framework/src/Control/HTTPResponse.php Source ====== 388: } elseif ($this->getStatusCode() >= 300) { 389: // It's critical that these status codes are sent; we need to report a failure if not. 390: user_error( 391: sprintf( 392: "Couldn't set response type to %d because of output on line %s of %s", 393: $this->getStatusCode(), 394: $line, 395: $file 396: ), * 397: E_USER_WARNING 398: ); 399: } 400: } 401: 402: /** 403: * Output body of this response to the browser Trace ===== user_error(Couldn't set response type to 500 because of output on line 419 of /home/bborg/public_html/vendor/silverstripe/framework/src/Control/HTTPResponse.php, 512) HTTPResponse.php:397 SilverStripe\Control\HTTPResponse->outputHeaders() HTTPResponse.php:343 SilverStripe\Control\HTTPResponse->output() index.php:25 Badge Detail Page
Executive
Badges

Score : pts
Category :
Code :

Resources :



IN THE COMMUNITY
Edge Workshops
HEAD OFFICE
BB New Zealand
2/2B William Pickering Drive
Rosedale
North Shore
Auckland 0632