aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2001-07-25 15:30:02 +0800
committerJon Trowbridge <trow@src.gnome.org>2001-07-25 15:30:02 +0800
commitb2470f6dd18cf7a5b1248ae0a10157d325f9205a (patch)
treeba28359ffe450f8096732b58344e722438002c44 /addressbook
parent109c8d5aa6bece62bf80c281111975bf70784f02 (diff)
downloadgsoc2013-evolution-b2470f6dd18cf7a5b1248ae0a10157d325f9205a.tar
gsoc2013-evolution-b2470f6dd18cf7a5b1248ae0a10157d325f9205a.tar.gz
gsoc2013-evolution-b2470f6dd18cf7a5b1248ae0a10157d325f9205a.tar.bz2
gsoc2013-evolution-b2470f6dd18cf7a5b1248ae0a10157d325f9205a.tar.lz
gsoc2013-evolution-b2470f6dd18cf7a5b1248ae0a10157d325f9205a.tar.xz
gsoc2013-evolution-b2470f6dd18cf7a5b1248ae0a10157d325f9205a.tar.zst
gsoc2013-evolution-b2470f6dd18cf7a5b1248ae0a10157d325f9205a.zip
Added checks for all of the args of the exposed functions, so that we
2001-07-24 Jon Trowbridge <trow@ximian.com> * gui/contact-list-editor/e-contact-list-model.c: Added checks for all of the args of the exposed functions, so that we won't crash on bad inputs. (Related to bug #4856.) svn path=/trunk/; revision=11394
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog6
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-model.c17
2 files changed, 23 insertions, 0 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 97216f6bb8..730f9cd396 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,9 @@
+2001-07-24 Jon Trowbridge <trow@ximian.com>
+
+ * gui/contact-list-editor/e-contact-list-model.c: Added checks
+ for all of the args of the exposed functions, so that
+ we won't crash on bad inputs. (Related to bug #4856.)
+
2001-07-24 Jason Leach <jleach@ximian.com>
* gui/merging/e-card-duplicate-detected.glade: "_Add Anyway" to
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-model.c b/addressbook/gui/contact-list-editor/e-contact-list-model.c
index b2b929eaa3..c4321c2820 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-model.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-model.c
@@ -167,6 +167,9 @@ e_contact_list_model_new ()
void
e_contact_list_model_add_destination (EContactListModel *model, EDestination *dest)
{
+ g_return_if_fail (E_IS_CONTACT_LIST_MODEL (model));
+ g_return_if_fail (E_IS_DESTINATION (dest));
+
if (model->data_count + 1 >= model->data_alloc) {
model->data_alloc *= 2;
model->data = g_renew (EDestination*, model->data, model->data_alloc);
@@ -185,6 +188,9 @@ e_contact_list_model_add_email (EContactListModel *model,
{
EDestination *new_dest;
+ g_return_if_fail (E_IS_CONTACT_LIST_MODEL (model));
+ g_return_if_fail (email != NULL);
+
new_dest = e_destination_new ();
e_destination_set_email (new_dest, email);
@@ -197,6 +203,9 @@ e_contact_list_model_add_card (EContactListModel *model,
{
EDestination *new_dest;
+ g_return_if_fail (E_IS_CONTACT_LIST_MODEL (model));
+ g_return_if_fail (E_IS_CARD_SIMPLE (simple));
+
new_dest = e_destination_new ();
e_destination_set_card (new_dest, simple->card, 0); /* Hard-wired for default e-mail */
@@ -206,6 +215,9 @@ e_contact_list_model_add_card (EContactListModel *model,
void
e_contact_list_model_remove_row (EContactListModel *model, int row)
{
+ g_return_if_fail (E_IS_CONTACT_LIST_MODEL (model));
+ g_return_if_fail (0 <= row && row < model->data_count);
+
gtk_object_unref (GTK_OBJECT (model->data[row]));
memmove (model->data + row, model->data + row + 1, sizeof (EDestination*) * (model->data_count - row - 1));
model->data_count --;
@@ -218,6 +230,8 @@ e_contact_list_model_remove_all (EContactListModel *model)
{
int i;
+ g_return_if_fail (E_IS_CONTACT_LIST_MODEL (model));
+
for (i = 0; i < model->data_count; i ++) {
gtk_object_unref (GTK_OBJECT (model->data[i]));
model->data[i] = NULL;
@@ -232,5 +246,8 @@ e_contact_list_model_remove_all (EContactListModel *model)
const EDestination *
e_contact_list_model_get_destination (EContactListModel *model, int row)
{
+ g_return_val_if_fail (E_IS_CONTACT_LIST_MODEL (model), NULL);
+ g_return_val_if_fail (0 <= row && row < model->data_count, NULL);
+
return model->data[row];
}