[poppler] [PATCH] fix crash on NULL action

Jeff Muizelaar jrmuizel at nit.ca
Wed Apr 6 19:33:41 PDT 2005


Should fix the crash with
http://freedesktop.org/~jrmuizel/uw-apr-bog-agenda.pdf

Index: glib/poppler-action.cc
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-action.cc,v
retrieving revision 1.1
diff -u -r1.1 poppler-action.cc
--- glib/poppler-action.cc	30 Mar 2005 04:08:26 -0000	1.1
+++ glib/poppler-action.cc	7 Apr 2005 02:31:44 -0000
@@ -248,35 +248,39 @@
 
 	action = g_new0 (PopplerAction, 1);
 
-	switch (link->getKind ()) {
-	case actionGoTo:
-		action->type = POPPLER_ACTION_GOTO_DEST;
-		build_goto_dest (document, action, dynamic_cast <LinkGoTo *> (link));
-		break;
-	case actionGoToR:
-		action->type = POPPLER_ACTION_GOTO_REMOTE;
-		build_goto_remote (action, dynamic_cast <LinkGoToR *> (link));
-		break;
-	case actionLaunch:
-		action->type = POPPLER_ACTION_LAUNCH;
-		build_launch (action, link);
-		break;
-	case actionURI:
-		action->type = POPPLER_ACTION_URI;
-		build_uri (action, dynamic_cast <LinkURI *> (link));
-		break;
-	case actionNamed:
-		action->type = POPPLER_ACTION_NAMED;
-		build_named (action, link);
-		break;
-	case actionMovie:
-		action->type = POPPLER_ACTION_MOVIE;
-		build_movie (action, link);
-		break;
-	case actionUnknown:
-	default:
+	if (link) {
+		switch (link->getKind ()) {
+		case actionGoTo:
+			action->type = POPPLER_ACTION_GOTO_DEST;
+			build_goto_dest (document, action, dynamic_cast <LinkGoTo *> (link));
+			break;
+		case actionGoToR:
+			action->type = POPPLER_ACTION_GOTO_REMOTE;
+			build_goto_remote (action, dynamic_cast <LinkGoToR *> (link));
+			break;
+		case actionLaunch:
+			action->type = POPPLER_ACTION_LAUNCH;
+			build_launch (action, link);
+			break;
+		case actionURI:
+			action->type = POPPLER_ACTION_URI;
+			build_uri (action, dynamic_cast <LinkURI *> (link));
+			break;
+		case actionNamed:
+			action->type = POPPLER_ACTION_NAMED;
+			build_named (action, link);
+			break;
+		case actionMovie:
+			action->type = POPPLER_ACTION_MOVIE;
+			build_movie (action, link);
+			break;
+		case actionUnknown:
+		default:
+			action->type = POPPLER_ACTION_UNKNOWN;
+			break;
+		}
+	} else {
 		action->type = POPPLER_ACTION_UNKNOWN;
-		break;
 	}
 
 	if (title)


More information about the poppler mailing list