{
ModestMainWindowPrivate *priv = NULL;
+ g_return_val_if_fail (MODEST_IS_MAIN_WINDOW(self), FALSE);
+
priv = MODEST_MAIN_WINDOW_GET_PRIVATE (self);
return (priv->display_state == OSSO_DISPLAY_ON) ? TRUE : FALSE;
{
gboolean play_sound;
+ g_return_if_fail (TNY_IS_LIST(header_list));
+
+ if (tny_list_get_length(header_list) == 0) {
+ g_warning ("%s: header list is empty", __FUNCTION__);
+ return;
+ }
+
/* Check whether or not we should play a sound */
play_sound = modest_conf_get_bool (modest_runtime_get_conf (),
MODEST_CONF_PLAY_SOUND_MSG_ARRIVE,
SendMsgInfo *info = (SendMsgInfo *) userdata;
TnyHeader *hdr1, *hdr2;
const char *msgid1, *msgid2;
+
+ if (!TNY_IS_MSG(msg)) {
+ g_warning ("%s: did not receive a valid msg", __FUNCTION__);
+ return;
+ }
hdr1 = tny_msg_get_header(msg);
hdr2 = tny_msg_get_header(info->msg);
#include <string.h>
#include <glib/gi18n.h>
+#include <tny-error.h>
#include <tny-account.h>
#include <tny-account-store.h>
#include <tny-store-account.h>
-#include <tny-error.h>
#include <tny-transport-account.h>
#include <tny-simple-list.h>
#include <tny-account-store.h>
gboolean found = FALSE;
TnyAccount *retval = NULL;
- g_return_val_if_fail (accounts && TNY_IS_LIST(accounts), NULL);
+ g_return_val_if_fail (TNY_IS_LIST(accounts), NULL);
+ if (tny_list_get_length(accounts) == 0) {
+ g_warning ("%s: account list is empty", __FUNCTION__);
+ return NULL;
+ }
+
iter = tny_list_create_iterator (accounts);
while (!tny_iterator_is_done (iter) && !found) {
TnyAccount *tmp_account = NULL;
const gchar *val = NULL;
tmp_account = TNY_ACCOUNT (tny_iterator_get_current (iter));
+ if (!TNY_IS_ACCOUNT(tmp_account)) {
+ g_warning ("%s: not a valid account", __FUNCTION__);
+ tmp_account = NULL;
+ break;
+ }
+
switch (type) {
case MODEST_TNY_ACCOUNT_STORE_QUERY_ID:
val = tny_account_get_id (tmp_account);
retval = g_object_ref (tmp_account);
found = TRUE;
} else {
- if (strcmp (val, str) == 0) {
+ if (val && str && strcmp (val, str) == 0) {
retval = g_object_ref (tmp_account);
found = TRUE;
}
send&receive was invoked by the user then do not show any
visual notification, only play a sound and activate the LED
(for the Maemo version) */
- if ((new_headers != NULL) && (tny_list_get_length (new_headers) > 0))
+ if (TNY_IS_LIST(new_headers) && (tny_list_get_length (new_headers)) > 0)
modest_platform_on_new_headers_received (new_headers,
show_visual_notifications);